Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Does not work:
- function reloadForm() {
- jQuery.ajax({
- url: "<generate_form_url>",
- type: "GET",
- complete: custom_function_with_js_in_response()
- });
- };
- $('#link_form').ajaxComplete(function() {
- custom_function_with_js_in_response();
- });
- $(document).ready(function() {
- $('#obj').click(function() {
- $.ajax({
- url: "<url>"
- }).done(function() {
- do_something_here();
- });
- });
- $(document).ready(function() {
- $('#obj').click(function() {
- $.ajax({
- url: "<url>",
- success: function(data){
- do_something_with(data);
- }
- })
- });
- // undefine the function before the AJAX call
- // replace myFunc with the name of the function to be executed on complete()
- myFunc = null;
- $.ajax({
- ...
- complete: function() {
- runCompleteCallback(myFunc);
- },
- ...
- });
- function runCompleteCallback(_func) {
- if(typeof _func == 'function') {
- return _func();
- }
- setTimeout(function() {
- runCompleteCallback(_func);
- }, 100);
- }
- $('.log').ajaxComplete(function(e, xhr, settings) {
- if (settings.url == 'ajax/test.html') {
- $(this).text('Triggered ajaxComplete handler. The result is ' +
- xhr.responseHTML);
- }
- });
- function reloadForm() {
- jQuery.ajax({
- url: "<generate_form_url>",
- type: "GET",
- complete: custom_function_with_js_in_response
- });
- };
Add Comment
Please, Sign In to add comment