-
-
Save RimonEkjon/62dc7c4f03fd9c44bb56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Javascript | |
$(function() | |
{ | |
var BASE_URL = window.location.protocol + '//' + window.location.host; | |
$("#buttonselector").click(function() { | |
var data = { | |
'inputelementname' : $('#inputelementselector').val(), | |
}; | |
$.post( BASE_URL + "/apply/ajax", data, function(response) { | |
console.log('Ajax loading successful'); | |
console.log(response); | |
}) | |
.fail(function() { | |
console.log('Ajax loading failed'); | |
}) | |
}); | |
}); | |
// Laravel Routes (you can use controller but this is just for testing) | |
Route::post('/apply/ajax', function() | |
{ | |
$data = Input::get('inputelementname'); | |
return $data | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment