Jump to content

Making Ajax Request


bravo14

Recommended Posts

Hi

 

I am using the code below to 'tag' an image in afacebook style,but I also want to add the tag details to a db

$("#img1").tag({
save: function(width,height,top_pos,left,label,the_tag){
	alert('I can save this tag ('+width+','+height+','+top_pos+','+left+','+label+')');
	/* once the ajax is done I need to get the ID here and then set it on the tag */
	the_tag.setId('someIdFromMyDb');
},
remove: function(id){
	alert('Here I can do some ajax to delete tag #'+id+' in my db');
}
});

 

Where it says alert('I can save this tag ('+width+','+height+','+top_pos+','+left+','+label+')'); and the_tag.setId('someIdFromMyDb');

 

I have the php page to add the tags to the database.

<?php
include('includes/connect_inc.php');
$lot_id=$_SESSION['lot_id'];
$top=$_GET['top_pos'];
$left=$_GET['left'];
$label=$_GET['label'];

$add_tag=("INSERT into `tbl_tags` (`lot_id`,`top`,`left`,`width`,`height`,`description`) VALUES ('$lot_id','$top','$left','100','100','$label')");
?>

I am just unsure as to how to send the request and get the details back of the tags

 

Any help would be much apperciated

Link to comment
https://forums.phpfreaks.com/topic/240366-making-ajax-request/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.