Run AJAX req with no conflict ?
-
Hello,
I have a function in functions.php file that makes json request. This is how I am calling this function:define('IS_AJAX_REQUEST', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); if (IS_AJAX_REQUEST){ loadmore(); }
Above code works just fine, but the problem is it conflicts with other AJAX request, for example, I see error message saying cannot execute loadmore() when I try to upload an image.
I tried following but none worked.
if (IS_AJAX_REQUEST && is_page()){ loadmore(); }
if (is_page()) if (IS_AJAX_REQUEST){ loadmore(); } }
if (IS_AJAX_REQUEST){ if (is_page()) loadmore(); } }
I only wanna execute loadmore() function when viewing a page. How can I do that ?
- The topic ‘Run AJAX req with no conflict ?’ is closed to new replies.