update a form and not load or reload page
I have a simple command:
<?php echo form_open("sales/add",array('id'=>'add_item_form')); ?>
How can I make this command so it just updates 开发者_开发百科the form, without reload or redirection. I dont even need to see the form. I have tried all sorts of methods, but wondering if there is something simple here I am missing. I just need to post the data. This is what is outputted by codeigniter.
<form action="http://127.0.0.1/index.php/sales/add" method="post" id="add_item_form">
<label id="item_label" for="item">
</form>
I have tried jquery but still does not work. Any help would be greatly appreciated.
You could use iframes or xml http requests (ajax)
You absolutely need jquery ajax function to do that. Maybe you have tried different jquery function. Check this out:
http://api.jquery.com/jQuery.post/
There are some examples in that link you can look at.
Do you know the path of your controller? Then you can use jQuery to do that. Check this plugin: http://jquery.malsup.com/form/
精彩评论