Extract form variable in AJAX response using jquery

Posted by Jake on Stack Overflow See other posts from Stack Overflow or by Jake
Published on 2011-11-16T17:48:47Z Indexed on 2011/11/16 17:51 UTC
Read the original article Hit count: 383

Filed under:
|
|

All,

I have a Jquery ajax request calling out a URL. The ajax response I receive is an HTML form with one hidden variable in it. As soon as my ajax request is successful, I would like to retrieve the value of the hidden variabl. How do I do that?

Example:

html_response for the AJAX call is : 
<html><head></head><body><form name="frmValues"><input type="hidden" 
name="priceValue" value="100"></form></body></html>


$.ajax({
        type: 'GET',
        url: "/abc/xyz/getName?id="+101,
        cache: false,
        dataType: "html",
        success: function(html_response)
        {
            //Extract form variable "priceValue" from html_response
            //Alert the variable data.                                 
        }
        });

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery