james182 Posted January 29, 2010 Share Posted January 29, 2010 ok here is my code it works great in Firefox but not at all in IE. The code should post the id of a item via ajax post method. Javascript: $(document).ready(function(){ $('a.addFavs').click(function(){ var favData = $(this).attr('id'); $.post("path/to/addFav.php",{ send_favData: favData }, function(data){ $('#msg').html(data.returnValue); }, "json"); }); addFav.php <?php include_once("config.php"); //addFavourite($_GET['send_favData']); // TESTING if (isset($_POST['send_favData'])){ $value = $_POST['send_favData']; }else{ $value = "No Data"; } echo json_encode(array("returnValue"=>"Value Returned: ".$value), true); ?> Function.php function addFavourite($favData){ global $link; $data = explode(",", $favData); $query = "INSERT INTO tbl_favourites (fav_id, fav_user_id, fav_item_id, fav_cat_id, fav_section_id) VALUES (NULL, '$data[0]', '$data[1]', '$data[2]', '$data[3]')"; $result = mysql_query($query, $link) or die("add Favourites fatal error: ".mysql_error()); if($result){ echo "<p>Successful!</p>"; }else{ echo "<p>Failed!</p>"; } } Quote Link to comment https://forums.phpfreaks.com/topic/190195-php-ajax-issue-with-ie/ Share on other sites More sharing options...
premiso Posted January 29, 2010 Share Posted January 29, 2010 I fail to see how this could be PHP related. It is most likely on the Client side with the javascript / AJAX and as such I doubt the error is in the code provided. Moving to the AJAX forms, you may want to provide the HTML that this code is being used on. Quote Link to comment https://forums.phpfreaks.com/topic/190195-php-ajax-issue-with-ie/#findComment-1003463 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.