thank you
Route::group(['prefix' => 'ajax'], function() { Route::get('/ajax', 'AjaxController@ajax'); Route::post('/ajaxpost', 'AjaxController@ajaxpost'); });<pre class="java" name="code">
<input id="name" name="name" type="text" value="hello channa" />
<input id="__token" name="__token" type="hidden" value="uAVNLARzB2zKp2hJElHXNRGSGLJ0gwqibXyqRXci" />
<input class="submit" id="submit" type="submit" />
<div id="loadingmessage" style="display: none;">
<img src="loading.gif" />
</div>
<div id="my_div">
</div>
<script>
$('#submit').click(function(){
$('#loadingmessage').show(); // show the loading message.
$.ajax({
type: "POST",
url: "http://localhost/bitbuckt/public/staff/ajaxpost",
dataType: "html",
data: { "_token" : "uAVNLARzB2zKp2hJElHXNRGSGLJ0gwqibXyqRXci" },
success: function( response) {
$('#my_div').html(response);
$('#loadingmessage').hide(); // hide the loading message
}
});
});
</script>
</pre>
create view form under resources -> view -> ajax ->ajax.blade.php
i passed _token key with data
public function ajaxpost() { print_r('data response '); } public function ajax() { return view('staff.ajax'); }
First of all, thank you for all the useful information. I would like to thank you for emphasizing the importance of playing an important role in the accommodation industry. I appreciate your hard work. Keep posting new updates with us.
ReplyDeleteDedicatedHosting4u.com