Paul's Javascript Notes

Showing posts with label synchronous. Show all posts
Showing posts with label synchronous. Show all posts

Tuesday, April 2, 2019

How to return something from ajax

Use a callback:

function something(callback){
 $.ajax({
        'url':'/some/url',
        'type':'GET',
        'data':{'some':'data'},
        'success': callback
   });
}

something(function (data) {
    data['id']; // use it here
})


See:

https://stackoverflow.com/questions/8187201/return-value-from-inside-of-ajax-function


Posted by Paul Chin at 6:46 AM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: ajax, callback, synchronous
Older Posts Home
Subscribe to: Posts (Atom)

Labels

  • ajax
  • android
  • api
  • apk
  • attribute
  • blob
  • bootstrap
  • C2
  • callback
  • chrome debug
  • chrome snippet
  • construct2
  • crop image
  • css
  • deviceready
  • draggable
  • events
  • excel
  • fiddle console
  • force refresh
  • framework7
  • icons
  • img
  • input
  • jquery
  • jquery gaming
  • jquery mobile
  • jquery mobile game programming
  • JQuery Mobile UI Builder
  • jquery ui
  • jsfiddle
  • json
  • jwt
  • linked list
  • loading external file
  • loops
  • market links
  • material design
  • mysql
  • navigator
  • node.js
  • onsen
  • overriding css
  • phonegap
  • php
  • pokemon
  • pushpage
  • pwa
  • remote debugging
  • selector
  • splitter
  • synchronous
  • templating
  • title length
  • truncated text
  • visual studio code
  • wordpress
  • zoom

Blog Archive

  • ▼  2019 (65)
    • ▼  July (1)
      • Mobile phone market share
    • ►  June (3)
    • ►  May (8)
    • ►  April (31)
    • ►  March (17)
    • ►  February (5)
Simple theme. Powered by Blogger.