Jump to content

Recommended Posts

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>";
}

}

Link to comment
https://forums.phpfreaks.com/topic/190195-php-ajax-issue-with-ie/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.