Solved

ajax jquery problem

Posted on 2014-12-30
3
63 Views
Last Modified: 2014-12-30
Hi,

I have the following code:
$.ajax({
    url : "pararlectura.php",
    type: "POST",
    success: function(data, textStatus, jqXHR)
    {
		var prueba = data
		alert(prueba)
		
        if (prueba == "YA"){
			
			alert ("test");
			clearInterval(myVar);
		}

Open in new window


My problem is that my alert(prueba) return YA, but alert("test") loop never executes, what is happening?
0
Comment
Question by:joyacv2
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40523458
replace : if (prueba == "YA"){
by : if ($.trim(prueba) == "YA"){
or by : if (prueba.replace(/^[^a-z]|[^a-z]$/gi,"") == "YA"){
0
 
LVL 1

Author Comment

by:joyacv2
ID: 40523468
excellent! i will close this and open another question about something in this code! Thanks!
0
 
LVL 1

Author Closing Comment

by:joyacv2
ID: 40523469
works perfect!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now