Question : Ajax compatibility problem with IE and Firefox

Hello!

I am using a JS code from dhtmlgoodies to load dynamic content into divs. Now, after programming a new page, I found that the ajax load content isn't working properly in IE but it does in Firefox. I guess it is a simple compatibility error, but as I don't know much about ajax I need some help.

Both files needed to load the content are attached.

Then I simply call the ajax load content like this:

ajax_loadContent(theloaderdiv,pagetocall);

It is working perfectly on Firefox but not in IE.

Thanks!!
Attachments:
 
 
 
needed file
 

Answer : Ajax compatibility problem with IE and Firefox

If you were using the .jquery library, you could use the $.get() function to request a response through ajax and then handle the results as a part of the call (rather than relying on the parent.<function> setup which can be fragile.

The $.get() function can take two parameters (URL and Callback function).  This is the real power of this library.  It will handle making the call to the page of your choice, waiting for the response, then taking an action once the call is complete.


A typical example in jquery would be:

function checkUserName(username) {
    $.get(
          //url with querystring to get results
          "checkuser.php?u=" + username,

         //callback function when the request is complete
         function(data,textResponse){
              if(textResponse=="success") {
                    alert(data)
              }
         })
}




You can return whatever you like from the checkuser.php page.  Simple html, json data, xml...whatever.  Your "data" in the .get() function is then the thing you inspect and act upon.  
Random Solutions  
 
programming4us programming4us