• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ajax

#1
[eluser]Unknown[/eluser]
Hi.
I am new to web programming (read my intro)
But i know ill have to use Ajax technology to get the result i want but im really lost on that point.
Could anyone point me out on a really straight to the point walkthrough.
Im sure there is plenty on the net but i could'nt find one.
Basicly waht i need to be ablle to get accomplished is:

1- refresh an html table (or somekthing else if necessary) on a button click from information from a Mysql database.

2- Make a call to a php function to process some information in an html page to update the database.

i think that ajax could be a solution but i am not sure. (any other way to do it is great to)
but the main point is to avoid redirect and full page reloading.

But i am aware that i may be completly off track but i hope not.

More detaille for point 1:

I have an html table with time entry for employe. this page allow for modification and adding new entry.
I have the js_calendar plugin and when i select a datae on the calendar and click refresh i want to refresh the table for the time entry of that day.

If i get to do that i should be able to answer point 2 myself.

#2
[eluser]gon[/eluser]
Steps are:

* getting the date from the datePicker.
* making an AJAX request, passing the date as an argument. you should be using a javascript library that will do things be easier. jQuery is very easy to learn and use. The URL will be one of your controllers, and the arguments the same as if you didn't use AJAX (URI segments or POST params).
* make the controller gets the data from DB, and render the view as usual. It won't be rendered in the browser, but sent to the AJAX call. Of course, the only thing that must be rendered is the data to be shown inside the table.
* when receiving the data from the AJAX call, replace the table HTML using innerHTML, or using DOM (which is harder of course). And, if neccesary, set events on the new content for doing actions.

Remember that AJAX doesn't neccesarily involves changing the CI part.

And use firebug to know what's happening. you can debug AJAX calls and answers.

cheers.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.