JQuery: Return $.get() callback to outer scope

后端 未结 4 867
生来不讨喜
生来不讨喜 2020-12-22 07:00

I\'m working on this validation script for my latest project, and one of the requirements is that it checks if the value that the user enters is in the database, and if it i

4条回答
  •  清酒与你
    2020-12-22 07:27

    The $.get() request is asynchronous. You will only have hasError set after the response comes in, which is a lot later than when you're checking it.

提交回复
热议问题