Milovanderlinden
2008-Feb-05 15:16 UTC
prototype-1.6.0.2 Newbie Why is AJAX.request fired 3 times?
Hello list! I am taking my first steps with AJAX and decided to give prototype a try. - I add a reference to the script to my page - Then somewhere near the bottom of the page I fire up: new Ajax.Request(''ws_adrestype.php'', { method:''get'', requestHeaders: {Accept: ''application/json''}, onSuccess: function(transport){ var json = transport.responseText.evalJSON(true); }, onError: function(){ alert(''Response was no JSON''); } }); And when I inspect the loading of the page with Firebug, I see that the request to my ws_adrestype.php is made three times. these requests get a response in 427, 260 and 121 ms. My ws_adrestype.php is currently running a not so optimized function. It selects all the unique address types from a postGres database by using a group by clause. Since the database is over 50000 records, I would like to make sure the request is made as less as possible. Therefor I am determined to strip the three calls to a single one. Another thing, My webpage is an edit page. Besides prototype, it also contains: - Google Maps script to show an address location in the page that can be dragged to move an address on a map - TinyMCE script to give the user the ability to enter fancy HTML that is then displayed in Google Earth in the so called "balloon" Can it be that GoogleMaps, TinyMCE and Prototyp ALL fire up my AJAX.request under water? As I said, I am a AJAX newbie. So any suggestion or help is appreciated! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---