Jump to content

Increasing the speed of AJAX response?


mattcairns

Recommended Posts

I've created an online app using some AJAX. On most machines it works fine, but on a few the response from the AJAX sections is very slow. The problem occurs in both ie and firefox. I am kind of new to AJAX, so I'm not 100% positive I am using it correctly, but here is the logic I am using.

 

On User Input the host page sends request to a .php file >

The .php file uses this request to perform a search on a mySQL database >

the result is formated for display in the .php file >

The host page displays the php formatted info.

 

By formatting I mean: in one instance AJAX is being used as a live search, when one types a name into a text box, a request is sent to a .php file, which returns a series of radio buttons with possible matches.

 

Based off of the tutorials I've read, this doesn't seem to be out of the range of what AJAX should used for, but it is moving very slowly on a few computers.

 

I am wondering if the constant searches being done on the php pages are causing the slowness. And if this is the case, I have an idea as to a solution, but am not sure exactly how to do it.

 

My possible solution: On page load, use php to create an XML document of all relevant information from all entries into the database. Then load the XML doc in and somehow use AJAX/php to parse the XML document and display. The only problem I have is, I am not totally sure how to parse the XML with php, so any help would be appreciated on that matter. My reason for thinking this may be a solution is, if the XML doc is already created, then one would not have to wait for each individual search.

 

If anyone has any input as to why it may be slow or if my possible solution is a good one, I would really appreciate the help. Thank you, especially if you took the time to read this whole thing.

 

Link to comment
Share on other sites

Hi mat

i have an opinion for your topics.

i think XML binding and parsing  both in php or javascirpt is not so easy .

To avoid the complexity of parsing of xml document , it would be better to use JSON.

JSON is nothing but JavaScript with Object Notation . It has two file one is json.js and another is json.php . json.js does the parsing task and json.php does the decode encode tasks.

For more info you can visit :  http://json.org/ or you can google json.

 

Thanks

ShaymoL

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.