Welcome Guest, Not a member yet? Register   Sign In
Ajax load
#1

[eluser]htarahi[/eluser]
Hi friends ,
I have 2 kinds of page's.
1 kind are the pages that will show normally.I mean with click on related link those pages appear.
2nd pages are those that load in ajax in the first kind.I mean their links are in 1st kind pages and after click on that ,the related 2nd kind page loads in ajax.
I know how to create 1st kind pages and the 2nd one itself.but I have know a little about ajax.
can you give me a simple example ?
briefly an ajax page that loads with a link.I need view ,model and controller pages.
Thanks
#2

[eluser]Unknown[/eluser]
Hi

I solve this by including the following in the 1st page, this will call your controller/method and display whatever is returned in the target div.

$('#buttonid').on('click', function(event)
{

$.ajax(
{
type: "POST",
url: "<?php echo base_url();?>index.php/controller/method",
data: {variable:value1,variable2:value2},
success: function(data, status)
{

$('#targetdiv').html(data);



}
}
);
}
);




Theme © iAndrew 2016 - Forum software by © MyBB