• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Regarding Ajax Response

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am facing one issue with Dates.Actually i am using two calenders ,start date and end date with ajax.On click of start date i am calling tha ajax and same on calling the end date.My issue is if i am clicking on the start date and if i am clicking on the end date, before the completion of start date, i am getting only the end date values , not the start date value and Vide versa.My requirement is show "Data Loading Please wait" info if I am clicking on the end date before the completion of start date.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you either need to not use global variables for your Ajax Requests or code your site so it is smart enough to wait until another request is done.

Eric
 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sandy,
It looks like both the date functions are refering the same variable or same name object, just check it out, if not could you post your code here for reference.
 
Sandy Siingh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sri
My code logic::

function UploadFromDate(){
var data = '';
if(req.readyState == 1||req.readyState == 2 || req.readyState == 3){
data = 'Loading the information. Please wait...';
renderAutomaticInfo(data); //
}
if(req.readyState == 4){
if(req.status == 200){
buildAutomaticHtml(req.responseXML); // calling url for From date
}
}

}

//Ajax Callback function called in case of Automatic To date selection
function UploadToDate(){
var data = '';
if(req.readyState == 1||req.readyState == 2 || req.readyState == 3){
data = 'Loading the information. Please wait...';
renderAutomaticToInfo(data);
}
if(req.readyState == 4){
if(req.status == 200){
buildAutomaticToHtml(req.responseXML); // calling url for To date
}
}

}


function renderAutomaticInfo(data){
var autodiv = document.getElementById("From Date");
autodiv.innerHTML = data ;
}


function renderAutomaticToInfo(data){
autodiv = document.getElementById("ToDate");
autodiv.innerHTML = data ;
}



My Question is::
I want to show " Please Wait Loading Data for From date" if user is clicking on the To date before the Server responce completion of From date.
 
Sri Gnana
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
If the "from date" field is not null then allow the user to select "to date", else show the alert or message "Please wait" or "from date yet to be loaded"...
 
Sri Gnana
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
also recheck with the function for proper space and error check
example give space between the condition in if statement

if(req.readyState == 1 || req.readyState == 2 || req.readyState == 3){

also check the id for From Date
is it "From Date" or without space "FromDate"

Follow the coding standards, then it is very easy work on and it is best practice.

 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic