• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AJAX help wanted

#2
First, load jQuery in the head section of your view.
Then, before the </body> closing tag, have this piece of code:

Code:
<script>
$(document).ready(function(){
    var url = "<?= site_url();?>controller/method";
    $.get( url, { p1: val1, p2 : val2 })
    .done(function(data) {
            //handle the returned data here
    });    
});
</script>

In the controller, use $this->input->get('p1') to read the value of p1.
Let the controller method echo the data that you need back in the view.
Reply


Messages In This Thread
AJAX help wanted - by John_Betong - 07-18-2017, 09:52 AM
RE: AJAX help wanted - by Wouter60 - 07-18-2017, 10:41 AM
RE: AJAX help wanted - by John_Betong - 07-21-2017, 01:22 AM
RE: AJAX help wanted - by InsiteFX - 07-22-2017, 02:29 AM
RE: AJAX help wanted - by PaulD - 07-22-2017, 02:16 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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