Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
JavaScript API - Sync Method
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="RastaLulz" data-source="post: 466017" data-attributes="member: 1"><p>When asking a question, try and simplify your code down to exactly what you're trying to do (and many times you'll figure out the solution in the process), instead of including a bunch of domain logic.</p><p></p><p>Anyways, [ICODE]$.when[/ICODE] returns a promise, so you'd likely do something like:</p><p>[CODE]function checkPhoneExists(phone) {</p><p> return $.when(checkPhoneNumberAjax(phone));</p><p>}</p><p>[/CODE]</p><p></p><p>Then you could reference it like:</p><p>[CODE]const result = await checkPhoneExists('XXX-XXXX');</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="RastaLulz, post: 466017, member: 1"] When asking a question, try and simplify your code down to exactly what you're trying to do (and many times you'll figure out the solution in the process), instead of including a bunch of domain logic. Anyways, [ICODE]$.when[/ICODE] returns a promise, so you'd likely do something like: [CODE]function checkPhoneExists(phone) { return $.when(checkPhoneNumberAjax(phone)); } [/CODE] Then you could reference it like: [CODE]const result = await checkPhoneExists('XXX-XXXX'); [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
JavaScript API - Sync Method
Top