response in ajax and php

function lectura(){
   
        $.ajax({
                url:   'lectura.php',
                type:  'post',
                beforeSend: function () {
                        $("#mensaje").html("Procesando, espere por favor...");
                },
                success:  function (response) {
					
						if (response == 999999999999999999999999999999){
							setTimeout(lectura(), 2000);
							$("#mensaje").html('espere unos segundos......');	
						}else{
    						$("#mensaje").html(response);
						}  
                }
        });

Open in new window


If i change the response == 99....... to a variable type text in the php and here don't work, only works if I compare with a number, why?
LVL 1
joyacv2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
Well that rather depends on what your page is returning to the ajax call
0
leakim971PluritechnicianCommented:
replace :
response
by :
response * 1
0
joyacv2Author Commented:
where i need to change response to response*1?
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

leakim971PluritechnicianCommented:
line 11
0
joyacv2Author Commented:
function lectura(){
   
        $.ajax({
                url:   'lectura.php',
                type:  'post',
                beforeSend: function () {
                        $("#mensaje").html("Procesando, espere por favor...");
                },
                success:  function (response) {
                              
                                    if (response * 1 == "test"){
                                          setTimeout(lectura(), 2000);
                                          $("#mensaje").html('espere unos segundos......');      
                                    }else{
                                        $("#mensaje").html(response);
                                    }  
                }
        });

change 99..... to test and in the php too and stop working
0
leakim971PluritechnicianCommented:
so << * 1 >> does'nt make sense until you compare with a number
0
joyacv2Author Commented:
ok, my problem is that compare in the if statement only works with numbers and not with text, and i don't know why?
0
leakim971PluritechnicianCommented:
where to see your code ?
what do you get in the alert doing this :
 success:  function (response) {
                              alert("<" + response + ">");
                                    if (response * 1 == "test"){

Open in new window

0
joyacv2Author Commented:
my text is the same that i summit the response variable don't compare text only numbers, with the 999999999999 works well
0
joyacv2Author Commented:
with this alert, i got the value but don't compare in the if statement
0
leakim971PluritechnicianCommented:
screen copy ?
a link to see that?
0
joyacv2Author Commented:
sorry, i don't have anyone
0
Ray PaseurCommented:
0
leakim971PluritechnicianCommented:
a screen copy, just hit the Print key once you have the alert and paste it in word document or a image editing tools to save it
0
joyacv2Author Commented:
0
GaryCommented:
Looks like you have a carriage return, so testing for test will not work since the response is

<br>
test

Open in new window

0
leakim971PluritechnicianCommented:
not "<br>test"
but : "\ntest"

first one is html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GaryCommented:
I was more trying to indicate there was another line, thought <br> would make it obvious ;o)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.