php - What is the best way to get jQuery/Ajax to work with CodeIgniter in this example? -


I have a problem in trying to get CodeIgniter and jQuery to create Ajax functionality. I've been coding all day, learning jQuery, and generally getting my butt kicked. Let me break the situation, and hopefully someone will have the courage to help me.

I have a hassle ticket system that displays many tickets on a page ... Each ticket is located inside many people Divs like:

  & Lt; Div class = "eachticketwrapper" id = "ticket-362" & gt; & Lt; Div class = "actionlog" & gt; & Lt; Form action = "& lt;? = Base_url () ;? & gt; Administrator / updateticket / 362" method = "post" id = "362" name = "362" & gt; & Lt; Ul class = "displayinline" & gt; & Lt; P & gt; Action log: & lt; Span class = "actionlog-362" & gt; & Lt ;? Php $ actionlog; ? & Gt; & Lt; / Span & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; -! Actionlog - & gt; & Lt; P & gt; & Lt; Textarea name = "actionlogbox362" cols = "100" rows = "2" id = "actionlogbox362" style = "" & gt; & Lt; / Textarea & gt; & Lt; / P & gt; & Lt; Div square = "last button" & gt; & Lt ;? Php echo form_open ('admin / updateticket /'. '362'); ? & Gt; & Lt; Li & gt; & Lt ;? Php $ attrib = "class = 'updatebutton-362' id = 'updatebutton-362'"; Model echo form_submit ("Rapid Task", 'Update', $ attrib); // setup buttons, and set permissions ? & Gt; & Lt; / Li & gt; & Lt ;? Php echo form_close (); // Close the form? & Gt; & Lt; / Div & gt; & Lt; -! Finalbuttons - & gt; & Lt; / Div & gt; & Lt; -! Everyticketwrapper - & gt;  

While running, $ actionlog should look something like:

  Worker - 2009-06-25 18:15:23 - Receive and accept tickets . Worker - 2009-06-25 18:15:23 - Status of Change in Progress Worker - 2009-06-25 18:15:46 - High Worker Changed Priority - 2009-06-25 18:15:46 - Changed class network connection problem for labor - 2009-06-25 18:17:16 - did something  

and then there is a text and an update button behind it.

Here is the content of my supplemental jQuery file:

  $ (document) .ready (function () {$ ('updatebutton-362'). () {Var id = $ (This) .attr ("id"). Divide the id value on the partition ("-"); // hyphen, and near the ticket. $ ('Action log -' + ID [1]) Load ('http: //localhost/ci/index.php/ajaxtestc/'); // something ... return false; // return false is not followed if default click behavior is not followed. });});  

The ajaxtestc controller looks like this:

  function index () {$ data ['actionlog'] = $ this- & gt; M_tickets-> ActionLogPull (362); $ This- & gt; Load-> ($ Data) Wars; $ This- & gt; Load-> ('Content / ajaxtestform') view; }  

and the m_tickets model looks like this:

  function actionLogPull ($ requestNum = NULL) {$ this- & gt; Db- & gt; Where ('ticket', $ is requested); // Get the position only for the ticket $ requested = $ requested ticket = $ this- & gt; Db- & gt; Receive ('ticket') request; // The initial ticket information is returned to a variable $ returnvalue = $ requested ticket- & gt; Set to row ('action log'); Return $ return value; }  

Now ... here is what I want to do. I want to click on the update button, to take it that the worker has typed in the text, add it at the end of the existing log in the database and refresh the action link on the screen.

I can not come in a clear way to do this. How can anybody start this process but any light can be highlighted?

Any help is greatly appreciated, and thanks in advance. Click

$ ('updatebutton-362'). Click , .load () < / Code> to replace (name, replace id) "itemprop =" text ">

the parameter you want to send):

  $ .post ('http: //localhost/ci/index.php/ajaxtestc/ ', {name: "John doe", id: "anything"}, function (data) {$ (' action log - '+ id [1]). Html (data);}});  

Then in index () in ajaxtestc controller above everything else, _POST variable and call Pars to update action logs Whatever your task is in your model.

index () Any action displayed will be loaded in actionlog .


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -