How do I make a PHP call whenever a form element is clicked?
I have a jQuery colorbox opened over top of my webpage (with a <select>
drop down list) and I'd like to make an AJAX call every time a new <option>
is selected from the drop down.
I have the followi开发者_Python百科ng code, but it's not picking up the select event.
$('#cboxLoadedContent select[name=parent]').live('select', function() {
$.get("edit.php", { fn: 'getFormatLevel', parent: $('select[name=parent]').val() }, function(data) {
alert("Data Loaded: " + data);
});
});
Any ideas why this isn't even recognizing my selector?
Does a select
event exist? I think it has to be change
:
$('#cboxLoadedContent select[name=parent]').live('change', function() {
$.get("edit.php", { fn: 'getFormatLevel', parent: $(this).val() }, function(data) {
alert("Data Loaded: " + data);
});
});
I am not sure 'select' is an event you might want to try 'change' or 'click' instead.
精彩评论