Sayfayı yeniden olmadan veritabanını güncellemek

0 Cevap php

Ive sadece, Sandeepan bazı fantastik yardım vardı teşekkür ederim!

Herkes bu yanlış yaptıklarını görebilirsiniz lütfen ....

<head>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javasript">

function addItemToUsersList(itemId)
{
  $.ajax({
      'url': 'member-bucketadd-execTEST.php', 
       'type': 'GET',
      'dataType': 'json', 
      'data': {itemid: itemId}, 
       'success': function(data) 
       {
           if(data.status)
           {
               if(data.added)
                {
                        $("span#success"+itemId).attr("innerHTML","Item added to your personal list");
                 }
                 else
                 {
                        $("span#success"+itemId).attr("innerHTML","This item is already on your list");
                }
            }
       },
       beforeSend: function() 
         {
               $("span#success"+itemId).attr("innerHTML","Adding item to your bucketlist...");
         }
          'error': function(data) 
          {
          // what happens if the request fails.
            $("span#success"+itemId).attr("innerHTML","An error occureed");
        }
});
                  }
     </script>

</head>

Sonra düğmeye fonksiyonunu etkinleştirmek için:

   <a onclick='addItemToUsersList("<?php echo $itemid ; ?>")'> Add<img src='images/plus-green.png' /> </a>

ve exec sayfa:

<?php 

if($bucketlist < 1) 
 {
    mysql_query("INSERT INTO membersbuckets (memberbucketid, userid, bucketid, complete)
    VALUES ('', '$userid', '$_GET['itemId]', '0')");
        return json_encode(array("status" => true, "added" => true));
 }
 else
 {
        return json_encode(array("status" => true, "added" => false));
 }



//echo "You are being directed to your bucket list, please wait a few moments...<meta http-equiv='Refresh' content='2; URL=mybucketlist.php'/>";
?> 

The links are showing up as links but nothing happens when I click them!! Here is the test page I am working on http://olbl.co.uk/showbucketsTEST.php Thank you in advance!

0 Cevap