coderman
coderman

Reputation: 355

How to find a input hidden element in jquery ajax success html response?

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.

Code:

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

Answers (1)

Ram
Ram

Reputation: 144689

You can try the find method:

var errorMessage = $response.find('#errorMessage').val();

Upvotes: 2

Related Questions