• Subcribe to Our RSS Feed

[WordPress] jQuery Ajax Call Does Not Works(404) In WordPress

Aug 21, 2013   //   by admin   //   Javascript, jQuery, Open Source, PHP  //  No Comments

Hi friends,

Today i am sharing you my knowledge on WordPress with jQuery Ajax call.if you are using WordPress core function in ajax call file than you must have to use my tips other wise you will get same problem which i got earlier.

wordpress-ajax-call-doesnt-success-404-error

Problem was that when i call page in WordPress by ajax its doesn’t showing me any error but call status showing me 404 it means path of file is not correct.but when i type that path in directly than its working fine. So i very tired to solve this error. This problem was happening because i am using WordPress core files in my ajax call files. in ajax_load_map2.php file i am using WordPress core library using include wp-blog-header.php files.

Don’t worry about it. i got solution and i am sharing with you with code that you have to add only one line code (header(“HTTP/1.1 200 OK”);) where you include wp-blog-header.php files.

define('WP_USE_THEMES', FALSE);
 
require('./../wp-blog-header.php');
header("HTTP/1.1 200 OK");
 
if(function_exists('fn_user_role_access_data_split'))
   echo fn_user_role_access_data_split();
else
   die("This functions is not exist");

I hope this article is very use full for you.Let me know if you need any help from me?

Thanks.

Leave a comment

*

Social Media Auto Publish Powered By : XYZScripts.com