0
function(data, textStatus, jqXHR) {
    $("#info").html(data);
    if ((data).substr(0, 5)=="Please") {$("#imgOk").fadeIn();} // doesn't work

data is is php echo from another page. It is successfully placed into div #info and it's content is:
Please, check your Inbox.

4
  • 1
    Can you elaborate a little bit... like what is the problem Commented Jan 13, 2013 at 12:57
  • @TheCOMPLETEPHPNewbie, there is no error. Just imgOk is not fadedIn Commented Jan 13, 2013 at 12:58
  • What happens if you alert data? What string do you get? Commented Jan 13, 2013 at 12:58
  • 3
    You did the substring wrong. Please is 6 characters. Commented Jan 13, 2013 at 12:59

1 Answer 1

4

Assuming data is fine, substr's second parameter is the amount of characters to retrieve, not the ending index. As "Please" is 6 letters, it should be .substr(0, 6).

See http://www.w3schools.com/jsref/jsref_substr.asp for more info.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.