0
I am developing a website for a real estate, at the moment I am listing the properties and paging the result with sql queries, are listed more than 2000 properties and there is a significant delay in uploading the content. I am thinking of returning the result of the sql query in JSON format with an AJAX request and listing the contents with Jquery.
What are the advantages and disadvantages of using this standard? Will I have performance in the content shipment? It is advisable to use AJAX requests that return large amount of content in JSON format?
It is not better to page the query?
– rray
There is already paging, but the content is displayed with direct query in sql, I want to return the result in json format.
– Igor Silva
Can you put the code that returns this query? vc does some processing or formatting in return?
– rray
I’ll edit the question.
– Igor Silva
You will have a little more processing because you will need to take the array of values returned from the database and apply a json_encode, however, I believe that it is nothing very significant not. However, the delay will depend on your return algorithm.
– Fábio Jânio
Is it better if I already return the html in ajax to insert the html dynamically? In this case I make a query Gero the html with echo, and in ajax I inform dataType: html. This way I get a better performance than returning json?
– Igor Silva