I have got the following code
<script>
$( "#brand" ).change(function() {
var values = $(this).serialize();
console.log(values);
$( "#model" ).load( "model.php?" + values);
});
</script>
The values are logged in the console. So the change function works and var values succesfully serializes the form fields.
The div id model exists but is not filled.
When I go to model.php?brand=123 myself the html output is correct
The load function however does not seem to do anything. What am I doing wrong?
Check response code first.
function( response, status, xhr ) {
if ( status == "error" ) {
var msg = "Sorry but there was an error: ";
$( "#error" ).html( msg + xhr.status + " " + xhr.statusText );
}
});
add this code like $(element).load(url, function(){..});
Try this:
$( "#model" ).load( "model.php" ,values);