I have some pages that i acces by jquery $.post like this:
$.post(url, {name: name}, function(data)
{
var htmldata = $(data);
if($('#ok', htmldata).val() == "1")
{
//some things carried out
}
});
$('#ok', htmldata).val() is allways undefined so where is the problem?
UPDATE: htmldata = <input id=\"ok\" type=\"hidden\" value=\"1\" /> and another 2-3 hidden input.
$('#ok', htmldata)will look for all descendants ofhtmldatathat have the id ofok.You need to change
$('#ok', htmldata)tohtmldata.filter('#ok')