Reputation: 355
I am calling function via ajax and I am getting the data properly, but I am not able to access the hidden elements in html returned.
success: function(data){
var $response = $(data);
var errorMessage = $response.filter('#errorMessage').val();
alert(errorMessage);
}
I am getting "undefined"
alert. What's wrong?
Upvotes: 1
Views: 2179
Reputation: 144689
You can try the find
method:
var errorMessage = $response.find('#errorMessage').val();
Upvotes: 2