How to do searching in PHP and AJAX?

Is it possible to develop AJAX pages without server side scripting (PHP, ...) except for AJAX processing?

  • What is the best way to develop web pages using AJAX? Do you create HTML pages or PHP pages which create HTML code and use AJAX to fill out the "missing content"?

  • Answer:

    I think you need to increase your understand about what AJAX is and how the web works to understand this. AJAX is simply javascript making http calls without refreshing your browser. So generally you will have .html page that has javascript that makes the call to the server (which is usually some .php page) . Upon finishing the call to the server the javascript has access to the data and can then fill out the "missing content". Remember - PHP is a programming language that runs on the server. It usually renders .html. Javasript is a language that is interpreted and ran by your browser (its does the AJAX) stuff. HTML - is basically just text/markup to let your broswer know what it's going to display.

Taylor Hawkes at Quora Visit the source

Was this solution helpful to you?

Other answers

Yes, it is possible, not the best way to use AJAX, but you can use it like that.  The AJAX call is made from client side, and you can call an PHP, ASP, HTML..., the thing is that if you are calling an HTML, why not include it from the start? The thing with AJAX (according with my experience) is that you are able to call dynamic data which result depends on the user interaction, so, you send variables to your server side scripted file, and get the according response in html, xml, json, plain text or whatever, and then use it.

Juan Manuel Diego González

Yeah, I actually built a website in this style. The main website contains the CSS, static html and javascript code. The javascript code contains views to render the content, which is pulled through AJAX, using Backbone.js and jQuery. The server side script parses the HTTP get requests and generates JSON strings that encode the model objects that then are used by the client-side script to fill the "missing content" in the website. This allows me to use two separate servers, one for the dynamic data (That uses Node.JS and MongoDB) and one for the static data using the time-proven Apache. This saves the dynamic part from the task of serving static content, as it only handles the HTTP requests generated by AJAX.

Marc Serra

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.