开发者

update a form and not load or reload page

开发者 https://www.devze.com 2023-02-16 16:21 出处:网络
I have a simple command: <?php echo form_open(\"sales/add\",array(\'id\'=>\'add_item_form\')); ?>

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消