I'm currently creating a website for comparing products. When someone does a search I've written code that goes off and finds/scrapes data for comparison.
Currently what I'm doing is having an ajax request for each company (currently 6 companies, although this could/will expand). The ajax request calls the php code which returns a json encoded array (company, name, price, type, size). As each request completes I'm using jquery to build the html block and then appending it to the page.
First Question: Is it better to use PHP to build the HTML or jQuery?
Now, I've got this working OK. However, now I'm getting to a point where I'm starting to think about using jQuery to manipulate the results (ie to sort and filter the results).
My thought process is basically to append all incoming ajax requests into another jquery array which I can then manipulate later as needed.
Second Question: Is the above logic sound, or am I missing a far simpler way of going about it?
Other Questions: Overall is this the right way (there might not necessarily be a right or wrong way, but is it the best way) of going about it? Is having multiple ajax requests going to make things die a horrible death the more users I get?