Support the ongoing development of Laravel.io →
Forms Packages
Last updated 2 years ago.
0

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');
}
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

Thanks, could you write the full example for me (with Laravel)?

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Thanks.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

yuomtheara yuomtheara Joined 12 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.