function showGetResult( name ) { var result = null; var scriptUrl = "somefile.php?name=" + name; $.ajax({ url: scriptUrl, type: 'get', dataType: 'html', async: false, success: function(data) { result = data; } }); return result; }
Reference :
jQuery return $.get data in a function - Stack Overflow
javascript - How can I get jQuery to perform a synchronous, rather than asynchronous, AJAX request? - Stack Overflow
沒有留言:
張貼留言