beanymanuk Posted May 4, 2010 Share Posted May 4, 2010 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 Quote Link to comment Share on other sites More sharing options...
Alex Posted May 4, 2010 Share Posted May 4, 2010 Try this: data: {content3: test3, votime: test4}, Quote Link to comment Share on other sites More sharing options...
beanymanuk Posted May 4, 2010 Author Share Posted May 4, 2010 Thankyou so much for that you dont know how long I have been stuck on that lol Quote Link to comment Share on other sites More sharing options...
Alex Posted May 4, 2010 Share Posted May 4, 2010 When stuck always consult the documentation http://api.jquery.com/jQuery.ajax/ Quote Link to comment Share on other sites More sharing options...
beanymanuk Posted May 4, 2010 Author Share Posted May 4, 2010 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.