1

我在视图中创建了一个表单,该表单调用了控制器中的某些方法。我想在提交按钮功能上做两件事:

使用 Ajax 函数在同一页面上显示输出,

使用 $this->input->post 函数获取数据(以与显示输出相同的方法)

4

2 回答 2

1

您可以在按钮上编写两个功能...对于type="button"

<input type="button" value="Don't show this again! " onclick="function1();function2();" />
于 2013-08-07T06:47:27.003 回答
0

你可以像这样使用ajax:

$.ajax({
    url: "Here is the url path",
    type: "GET",
    data: {},
    beforeSend:function(){
        //do something like loading image
    },
    success:function(response){
        alert(response); //do something
    },
    error:function(e){
        alert("something wrong"+e);
    }
})
于 2013-08-07T06:38:22.637 回答