I would like to assign a variable inside an $.ajax() function so that it’s still available the next time the function is called…
Is this possible?
var xxx = 1; isn’t doing the job.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think you should do something like that and avoid DOM manipulation for that…
Since I don’t have real code from your app I can’t give more exact code but I think you’ll get the idea.
The key idea is the scope. Whenever you have your var in a higher scope you’ll be able to modify it in a lower scope, without using the
varkeyword.