How to send some data to a function without loading a new page |
[eluser]ethio[/eluser]
I'm trying to send a product id to a method without loading a new page, and since I do not have a sentence in the method to load another view I get a blank page. This is the from inside the product view Code: echo form_open('shopping_basket/add_to_basket/'); I have also tried using JavaScript which also loads a blank page Code: echo "<a href='' return false;'>Add to Basket</a>";
[eluser]ethio[/eluser]
Code: [removed] I'm using this jquery script now and it doesn't work. Looking at the console tab in Chrome it gives this error: Uncaught TypeError: Object [object Object] has no method 'ajaxForm' EDIT: ajaxForm is not in the JQuery documents, I think it's deprecated and that's why I got that error message. I'm using the .submit function now.
[eluser]niki_mihaylov[/eluser]
Jquery ajax form is a plugin that helps you handle ajax calls. More info here: http://malsup.com/jquery/form/ In your case you can do something like: Code: $.ajax({ in the example i often use _ROOT as helper variable for my javascript file. I usualy set it on top of my documment like so: Code: var _root = "<?php echo site_url() ?>"; |
Welcome Guest, Not a member yet? Register Sign In |