1

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?

0

1 Answer 1

2

You can try the find method:

var errorMessage = $response.find('#errorMessage').val();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.