I'm having a bit of an issue with my jQuery code. It runs a an ajax request through jQuery.POST to run a .php file. After that the results are displayed in a div. The problem I am having is that the results are not being displayed, but the .php file is definitely being executed as the values are being updated when I refresh the page.
In the console I get the following error.
POST http://domain.com/path/to/my/file/myfile.php 404 (Not Found) jquery.js?ver=1.8.3:2
send jquery.js?ver=1.8.3:2
v.extend.ajax jquery.js?ver=1.8.3:2
v.(anonymous function) jquery.js?ver=1.8.3:2
(anonymous function) domain.com/url/function/here/:2723
v.event.dispatch jquery.js?ver=1.8.3:2
o.handle.u jquery.js?ver=1.8.3:2
Here is my jQuery code
jQuery('.wantedStatus').on('click', function(event)
{
var anime_id = <?php echo $anime_id; ?>;
var anime_list_entry_id = <?php echo $anime_list_entry_id; ?>;
var wantedStatus = jQuery(this).text();
jQuery.post("/path/to/my/file/myfile.php", {firstParam : anime_id, secondParam : anime_list_entry_id, thirdParam : wantedStatus}, function(data) {
//this is your response data from serv
console.log(data);
jQuery('#anime_list_update').html(data);
});
return false;
});
and here is the myfile.php
code...
<?php
require('/home2/phanime/public_html/wp-blog-header.php');
$anime_id = $_POST['firstParam'];
$anime_list_entry_id = $_POST['secondParam'];
$wantedStatus = $_POST['thirdParam'];
$total_episodes = get_post_meta($anime_id, 'anime_total_episodes', true);
$episodes_seen = get_post_meta($anime_list_entry_id, 'episodes_seen_list_entry', true);
$score = get_post_meta($anime_list_entry_id, 'score_anime_list_entry', true);
update_post_meta($anime_list_entry_id, 'status_list_entry', $wantedStatus);
echo $status = get_post_meta($anime_list_entry_id, 'status_list_entry', true);
?>
<?php get_entry_anime_list_text($status, $score, $episodes_seen); ?>
The ending function get_entry_anime_list_text(params)
is what is suppose to be outputted. However, nothing is being outputted and on top of that I am getting that error in the console.
I've tried commenting out get_entry_anime_list_text()
function but the error still exists.
Does anyone have an idea why this error is popping up?