Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function1();
- function2();
- Please look at the code written below:
- function1() {
- $.ajax({
- url: myurl,
- type: 'GET',
- async:false,
- success: function(response) {
- function2();
- }
- });
- }
- function1() {
- ...
- $.ajax({
- url: '...',
- type: 'GET',
- success: function(data) {
- // this will be executed after the asynchronous method finishes
- function2();
- }
- });
- }
- function function1()
- {
- //Ajax Call
- ..
- ..
- if (xmlhttp.readyState==4 && xmlhttp.status==200)
- {
- function2();
- }
- }
- function1() {
- $.ajax({
- url: myurl,
- type: 'GET',
- success: function(response) {
- function2();
- }
- });
- }
- function1(function() {
- function2();
- });
- function function1() {
- $.ajax({
- url: "url",
- type: 'POST',
- }).success(function (html) {
- function2();
- });
- }
- function ajaxCall(){
- return $.get('your/api/call', {param:1});
- }
- function fun1(){
- console.log('Function 1 was called');
- }
- function fun2(){
- console.log('Function 2 was called');
- }
- ajaxCall().done(fun1).done(fun2);
- $.when( $.get('your/api/call') )
- .then(function(){ alert(1); })
- .then(function(){ alert(2); });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement