コントローラーのメソッドを呼び出すフォームをビューに作成しました。送信ボタン関数で 2 つのことをしたい:
Ajax関数を使用して出力を同じページに表示し、
$this->input->post 関数を使用して (出力を表示しているのと同じメソッドで) データを取得します
コントローラーのメソッドを呼び出すフォームをビューに作成しました。送信ボタン関数で 2 つのことをしたい:
Ajax関数を使用して出力を同じページに表示し、
$this->input->post 関数を使用して (出力を表示しているのと同じメソッドで) データを取得します
ボタンに2つの関数を書くことができます...type="button"
<input type="button" value="Don't show this again! " onclick="function1();function2();" />
次のように 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);
}
})