aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Regarding Ajax Response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Regarding Ajax Response" Watch "Regarding Ajax Response" New topic
Author

Regarding Ajax Response

Sandy Siingh
Greenhorn

Joined: Oct 16, 2008
Posts: 5
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Apr 29, 2004
Posts: 166
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.


Thanks & Regards
Sri Gnana
Everythings Programmed!...
Sandy Siingh
Greenhorn

Joined: Oct 16, 2008
Posts: 5
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

Joined: Apr 29, 2004
Posts: 166
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

Joined: Apr 29, 2004
Posts: 166
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
 
subject: Regarding Ajax Response