3
I made a script with Jquery to use AJAX and it’s working. The problem is when interpreting the XML is returned, the XML is the result of a login attempt, it contains information indicating whether the user was authenticated or not, if not, it contains an error description:
<result id='0 ou 1'>erro caso exista ou fica vazio</result>
But when it’s time to read this:
success: function(data){
var s = $(data).find("result").each(function(){
var id = $(this).attr('id');
if(id == 0){
var error = $(this).text();
$(".error_description").text(error);
$(".error_description").css(display:"block");
}
else{
$(window.document.location).attr('href', "/Snotes/user_panel.php?id=" + id);
}
});
}
The code was inspired by the tutorials of several web posts, but is not working, and now that Google Chrome no longer wants to stop us breakpoint within the function each
, it gets harder.
$(".error_description").css(display:"block");
Was it a typo writing the question, or is your code that way? (Keys were missing:css({display:"block"})
) In addition, on condition of success theaction
That’s the way it is, or you didn’t mean$("#go")[0].action
? (i.e. this attribute - which I don’t know - is from the jQuery object or the DOM element?)– mgibsonbr
Fixed, the ("#go") I found on the web, a redirect method, is just like that
– ProgramandoMil
Hmm, it looks like #go might actually be an element of the html page, I’ve already modified there as well.
– ProgramandoMil