better way to do ajax reponse call? |
[eluser]Angkor[/eluser]
My CI app use dropdown like this: http://www.codeassembly.com/examples/jqu.../test.html Code: $(function() combobox.php ++++++++++++ Code: <?php Now it works But any better ways to implement the commbox.php by using codeIgniter Frameworks. for example with connect to database ..I use php that I put username ,pass directly ..How can we got from the config file of IC? or any good ways to do it? thanks
[eluser]vitoco[/eluser]
Steps : 1.- download codeigniter DOWNLOAD 2.- install codeigniter INSTALLATION GUIDE 3.- Watch the tutorial videos INTRO CREATING A BLOG IN 20 MINUTES 4.- Create the controller / function 5.- Create, configure database DB GUIDE 6.- Checkout the json helper WIKI : JSON HELPER 7.- make it work.... Saludos
[eluser]whobutsb[/eluser]
What I like to do is create a AJAX controller that is devoted to receiving and sending back JSON responses with echos. My guess is you already have CI installed. Create a new controller call it AJAX controller, create a function that will take the jQuery AJAX submit, do the processing with your database using models and then encode your data into JSON and echo it back out. jQuery will pick up the response with out a problem.
[eluser]Myles Wakeham[/eluser]
Yep, we do this too. Have a separate controller for all AJAX calls as the overall interface for this. Also you will need to have a strategy for security, and cross-domain AJAX communications if you are going to share the CI app with multiple domains. We use a PHP proxy code base on the client and have jQuery work with it locally, and then have that communicate with our CI apps. But like everything in PHP, think security, think security, think security.... Myles |
Welcome Guest, Not a member yet? Register Sign In |