wordpress ajax keeps losing connections -
i apologize being little more han newbie in wp , ajax need help. i'm not sure if it's bug or it's me cannot manage find solution.
i've following situation.
i've plugin displays data remote mysql server. data need updated periodically.
at moment i've implemented through ajax, more or less, this:
$.ajax({ type : "post", url: cktn_ajax_object.ajax_url, data: params, datatype: "json", success: function(response) { << update ui according response >> }, error: function(request, status, err) { console.debug("[ajaxontimer error] status: " + status); } }); where $.ajax calling relevant php script responsible retrieving remote mysql data. php script duration variable, according amount of data fetches (let's say, between few seconds , 4 or 5 minutes).
if test whole on local machine, there no problem. ajax call duly , patiently awaits (slow) response of local php server (which querying remote mysql server) , eventually, upon completion, updates ui.
on other hand, when install plugin on production machine things don't work expected. few seconds after having placed ajax call php server, following error in console of browser:
failed load resource: connection lost. ---> admin-ajax.php
and script fails leaving me no other clue word error in 'status' parameter of ajax call.
apparently heartbeat.lock-post interfering ajax call. idea of doing wrong?
add following functions.php turn off heartbeat:
add_action( 'init', 'my_deregister_heartbeat', 1 ); function my_deregister_heartbeat() { global $pagenow; if ( 'post.php' != $pagenow && 'post-new.php' != $pagenow ) wp_deregister_script('heartbeat'); } and restart apache.
Comments
Post a Comment