如何检查返回的结果是否包含特定值?
$(function () {
$('form').submit(function (e) {
e.preventDefault();
$.ajax({
url: this.action,
type: this.method,
data: $(this).serialize(),
success: function (result) {
//here i wanna check if the result return contains value "test"
//i tried the following..
if($(result).contains("test")){
//do something but this doesn't seem to work ...
}
}
},
});
});
});