Hi Guys,

Can't seem to get my head around this one. I need to send a bunch of variables to php so that i can store the values in a database, but i just can't figure out a way to do that. Pls help. here's a little code

$( "#droppable2" ).droppable({
	activeClass: "ui-state-hover",
	hoverClass: "ui-state-active",
	accept: "#draggable3",
	drop: function( event, ui ) {
				
		var jdc = $(this).attr("id"); //I need to post this variable
		$( this )
			.addClass( "ui-state-highlight" )
			var x = ui.helper.clone();   
			x.appendTo('body');
					
			var jdi = $("img").attr("id");//I need to post this variable
					
			$(this).droppable( 'disable' );
					
			x.append("<span>x</span>")
			$("span").click(function (){
				$("#droppable2").droppable('enable');
				x.remove();
			})
	}
});

I can post more code if needed. I really need this.

Thanks in advance

Recommended Answers

All 3 Replies

What doesn't work? Take a look at $.ajax and $.post.

Thanks for the response twiss.

Perhaps my need was not stated correctly. What I want to do is to save or be able to access those variables later on in the script, but because they are local variables... I am having problems calling them later on in the script.

In a nutshell, I want to be able to call up local variables from other three identical functions and send them all together later on. If that makes sense.

If the need for storing is only temporal, then cookies could help with this. Otherwise you could use AJAX to store (and retrieve) those values more permanently.

http://www.w3schools.com/xml/xml_http.asp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.