我正在尝试获取提交按钮上的另一个功能,即。 class =“sucessClass”在成功或完成时执行。这是我的代码:
$(document).ready(function() { $("#send").on("click", function(){ var name=$("#name").val var email=$("#email").val var message=$("#message").val var dataString="name=" + name + "&email=" + email + "&message=" message; $.ajax({ type: "POST", url: "proData.php", data: dataStringxx, success: function(html){ |=== sucess function ===| } else{ } } }); Name : Email : Message : Send
答案 0 :(得分:2)
您可以尝试类似
的内容$(document).ready(function() {
$("#send").on("click", function(){
var name=$("#name").val();
var email=$("#email").val();
var message=$("#message").val();
var dataString="name=" + name + "&email=" + email + "&message=" message;
$.ajax({
type: "POST",
url: "proData.php",
data: dataStringxx,
success: function(html){
$('.successClass').trigger('click');
}
});
});
$('.successClass').click( function(){
// write your code here what needs to be done.
});
});