Jump to content

.ajax passing two values


beanymanuk

Recommended Posts

Hi I am trying to pass two values from text boxes and insert them into database

 

Passing values content3 and votime

Is this section of code right in putting the values into one var called dataString

 

$(".comment_button3").click(function() {
	var element = $(this);
	var test3 = $("#content3").val();
	var test4 = $("#votime").val();
	var dataString = 'content3='+ test3 + '&votime='+ test4;

	if(test3=='')
	{
		alert("Please Enter Some Text");
	}
	else
	{
		$("#flash").show();
		$("#flash").fadeIn(400).html('<img src="http://tiggin.com/ajax-loader.gif" align="absmiddle"> <span class="loading">Loading Comment...</span>');
		$.ajax({
		type: "POST",
		url: "http://www.peter-gosling.com/tagit/timetags/demo_insert.php",
		data: { dataString} ,
		cache: false,
		success: function(html)

 

demo_insert.php file

$content=$_POST['content3'];
$time=$_POST['votime'];
round($time);
mysql_query("insert into tagbytime (id ,tag, time,userId ,videoId) VALUES (NULL,'$content','$time','$user','$thisvideo') ");

 

Currently it is just getting the dataString value and inserting this value into $content

 

Thankyou in advance for any help

Link to comment
Share on other sites

Thankyou for that link that is very helpful I have not come across that site before. I'm still getting into jquery

You dont know of any good books etc I could look into to learn more?

 

Also have you any experience with Facebook API I am trying to only bring up the login page to facebook if a button is pressed and once logged into facebook reveal a text box

Link to comment
Share on other sites

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.