Why would you want to use a package for that, this is not a js framework. Create a js file and create those onChange functions and your done.
<input type="text" onchange="myFunction()">In your js file:
function myFunction() {
console.log('hello world');
}
I want to use ajax to get data from php and then change any form object. Ex: I onChange select box "A" and then select box "B" is changed data automatically.
Something like this?
$('#select1').on('change', function (e) {
$.ajax({
url: "action.php",
type: "POST",
data: formData,
success: function(response)
{
$('#select2').attr('value','200');
$('#select2').text('200');
},
error: function(jqXHR, textStatus, errorThrown)
{
...
}
});
});
edit: formData is some optional array passed to the php script
Thanks, could you write the full example for me (with Laravel)?
This code actually has nothing to do with Laravel, it is just jQuery. You have to write php script which will be called inside ajax request (action.php in example) and return some value. I have no idea what you're trying to do with it so I can't help you any more.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community