Passing variables to Controller ? |
[eluser]yannyannyann[/eluser]
Hi there I have an ajax call to make and I want to pass variables my controler www.mysite.com/controller/index/ Code: function index($offset = 0) { So for example with jQuery how do I pass the arguments ? Is it something like this ? Code: $.ajax({
[eluser]xwero[/eluser]
Code: $.ajax({
[eluser]yannyannyann[/eluser]
Ok thanks, it works. My link to call the ajax is down the page and I don't want the page to go up again once I click and do the ajax call. I guess it has something to do with the HREF="#", but I don't remember how to solve it ? Code: <li><a href="#" id="next">Next</a></li> Code: [removed]
[eluser]yannyannyann[/eluser]
I'd like to know now how I can pass the arguments : - current page - current language I have in PHP this function ready : Code: current_language() // returns "fr" or "en" For example I would like to be able to pass these parametres to the URL like in the below examples, but dynamically : Code: $.ajax({ Code: $.ajax({ Code: $.ajax({
[eluser]yannyannyann[/eluser]
To sum up, is it possible to do something like this in my jQuery Ajax call? (check out the BASE_URL call and the $current_block variable ) Code: $('#next').click(function() {
[eluser]n0xie[/eluser]
I think you need to solve that with javascript. Seems to me you want to simulate paging. In that case store the current page in a javascript variable. Add 1 to this variable whenever someone presses '#next', and send the ajax request. Something like this (this is untested pseudo code so it might not work): Code: var currentpage = <?=$current_block?>;
[eluser]yannyannyann[/eluser]
yes it's a kind of paging system, you are right. Thanks I will declare this currentpage in JS. |
Welcome Guest, Not a member yet? Register Sign In |