Ajax architecture question

I have a page with 3 layers, one for navigation, one for database records and one for results. When I click on a database record, the results are displayed in the result layer via ajax. For navigation, the links will be just different requests. I am wondering if it would make sense for every other request to be sent as ajax data and hit the posts layer, or rather add the request to the php file every time. What's the more efficient approach?

0


source to share


2 answers


Ok, sending another AJAX request would be recommended as per my point of view. how

  • Performance , this will likely decrease response times as only POST and received data will be sent. The page can then format it and it receives an XMLHttpResponse

  • Security measures . I prefer using POST over GET as it gives at least some opacity as to what is passed as a parameter and no one can just edit the url and play. Plus , you have no URL length limitation when passing parameters in POST.



So, I would say, fire XMLHTTPRequest on each feed and response at the result level (panel / div) on the page.

0


source


I think you doubt this is non-specific and confusing. What's added to the php file?

Are you really concerned about efficiency? I mean, how fast should the results be displayed? Or are you worried about server load?



Have you read this tutorial? Introducing a prototype to Ajax I think it should answer most of your questions and provide enough sample code to continue.

0


source







All Articles