This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Ajax Response

 
Sandy Siingh
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Sri Gnana
Ranch Hand
Posts: 166
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic