Welcome Guest, Not a member yet? Register   Sign In
How to catch data from view to controller usin Jquery ?
#1

[eluser]ludo31[/eluser]
Hello ;
I would like to try this tutorial

http://mrforbes.com/blog/2009/01/a-quick...comment-99

I change some code in order to adapt it in my case but it doesn't work :

in my view :

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;jquery&lt;/title&gt;
    
    [removed][removed]
  
    
[removed]
function get_record_id(record_id) {
     var p = {};
     p[record_id] = record_id
     $('#content').load(/welcome/method,p,function(str){

     });
}

[removed]
    
    
    
&lt;/head&gt;
&lt;body&gt;

   <div id="content">
    
    
   <p>If you click on me, I will disappear.</p>
  
  
  



    </div>


&lt;/body&gt;
&lt;/html&gt;

in my controller :

Code:
public function method()
    {
      
        
         $record_id = $this->input->post('record_id');
        
        
  
         $results = $this->essaijquerymodel->get_record($record_id);
   //get the record from the database
        
          $this->load->view('ajax_record',$results);
          
          
        
    }

and in ajax recodr view


Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;ajax&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;




&lt;?php  if ($results != null):
     foreach ($results  as $r=>$value): ?&gt;


  The name associated with this record is: &lt;?php print $value['titre'];?&gt;

    &lt;?php endforeach;endif; ?&gt;        



&lt;/body&gt;
&lt;/html&gt;

did you know whta's wrong and where ??

thanks




Theme © iAndrew 2016 - Forum software by © MyBB