anchor onclick |
[eluser]Dainius123[/eluser]
Hello, i'm new to codeigniter, and here is my problem: Is there is any way to do something else instead of going to controller's method after clicking anchor? i have anchor, and i need to set_flashdata after user clicks on anchor link. (i need to pass data to controller from view after user clicks on anchor ( i can't pass data thru URL because i use routing), or is there any other way to send data? maybe submit form without submit button? is such thing exist?) Thanks for help! Dainius.
[eluser]JoostV[/eluser]
If you need to send data without refreshing the page, take a look at jQUery ajax functions: http://api.jquery.com/jQuery.post/ http://api.jquery.com/jQuery.get/ By the way, it is entirely possible to pass data thru URL if you use routing. http://ellislab.com/codeigniter/user-gui...uting.html
[eluser]R_Nelson[/eluser]
what JoostV said is true i use it to make templates Code: $this->load->view('site',$data) Code: $data['content']='index'
[eluser]Dainius123[/eluser]
i need to have form drop down(without submit button[i think that i have to use javascript]), and i need to send data then user clicks on selection(to controler, maybe flashdata?), but i can't send data thru URL because i have such requirement(my URL has to be always the same no matter what user selects in drop down[after click i'm loading same view just diferently sorted data]) and also i don't want to go to database from view to change any value after click(if i will need to access database i must do it from controler), soo is there is any other way?, or it's possible to do with jQuery?
[eluser]JoostV[/eluser]
Yes, this is possible with jQuery. You use jQuery to make an ajax call to another page. Because this call is made asynchronously, the browser will not refresh and the URL in the browser address bar will remain the same. Having said that: the jQuery ajax call needs to load a certain controller in your site. For more info, read the jQuery documentation. It's very good.
|
Welcome Guest, Not a member yet? Register Sign In |