开发者

How do I make a PHP call whenever a form element is clicked?

开发者 https://www.devze.com 2022-12-23 13:49 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消