I have two autocomplete scripts, one of them makes use of (A) php/mysql/html/jquery and the other makes use of (B) html/jquery/json.
I know that since they're using different technologies they might not be able to be compared directly, but from your own experience and from what you can gather from the pages these scripts are located on,
(Q:1) Which one would be faster/Better? (of course this is all pre开发者_如何学编程ference i'm sure)
(Q:2) Why do you think that?
(Q:3) What are the benefits/downside to both?
I'll be hosted on a shared server on mediatemple for 20$ a month, eventually i'm going to go to the dedicated-virtual 50$ server.
Any information/direction would help a lot, thanks!
I would go for A as it is easier to customize. With B you lock yourself into a specific server solution.
They do use almost the same technology - the difference is mainly that B returns HTML (more data = slower) instead of JSON when using AJAX and with A you would have to write your own search logic server code.
It mainly depends on how conversant you are with the different technologies and what you are trying to do. If you know some server language I would definitely go for A as you have full control over search results returned.
If you have a very limited number of search results A is definitely the answer as you would not have to involve any server code at all. This means search would be very fast. Only code from you needed:
$('input#suggestBox').jsonSuggest('[{"id":1,"text":"Search Data 1"},{"id:2,"text":"Search Data 2"}');
To wrap up. If you are a coder go for A, if you want something limited that would be a bit slower but would work out of the box go for B.
精彩评论