Google Groups Home
Help | Sign in
$.post() not sending info
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
riscphree  
View profile
 More options May 16, 7:59 pm
From: riscphree <riscph...@gmail.com>
Date: Fri, 16 May 2008 16:59:27 -0700 (PDT)
Local: Fri, May 16 2008 7:59 pm
Subject: $.post() not sending info
I've got a suggestion form that inserts into a db table when they
submit, my jquery is located in a /js folder, while this page is in /,
and my db settings are in /includes/

Here is my $.post

$.post("../sendsuggest.php",
               { subject: subjectVal, message: messageVal,
theusername: theUser  },
                  function(data){
                  $("#sendSuggestion").slideUp("normal", function()
{

                     $("#sendSuggestion").before('<h1>Success</
h1><p>Thank you for your comments!</
p>');
                  });
                  }
             );

sendsuggest.php is something like this

if(isset($_POST['submit'])) {
   $theuser = $_POST['theusername'];
   $subject = $_POST['subject'];
   $message = $_POST['message'];
   include("includes/database.inc");
   connect_to_cms();
   $sql = mysql_query("INSERT INTO suggestions(user,message,subject)
VALUES('$theuser', '$message', '$subject')");

}

On my page, the slideUp works and this line: $
("#sendSuggestion").before('<h1>Success</h1><p>Thank you for your
comments!</p>');

works as well, but I can't figure out why it isn't inserting into the
db. Any hints?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Huck  
View profile
 More options May 17, 12:05 am
From: Jason Huck <jason.h...@gmail.com>
Date: Fri, 16 May 2008 21:05:59 -0700 (PDT)
Local: Sat, May 17 2008 12:05 am
Subject: Re: $.post() not sending info
If this code is verbatim, then I would say it's because your $.post()
call does not include a "submit" param, which is what sendsuggest.php
is checking for in order to process the submission.

- jason

On May 16, 7:59 pm, riscphree <riscph...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
riscphree  
View profile
 More options May 17, 2:24 am
From: riscphree <riscph...@gmail.com>
Date: Fri, 16 May 2008 23:24:44 -0700 (PDT)
Local: Sat, May 17 2008 2:24 am
Subject: Re: $.post() not sending info
Ah, I see now. I went ahead and got the Forms plugin working and that
was really so easy to do. At least I know how to do it another way
now.

Thanks!

On May 17, 12:05 am, Jason Huck <jason.h...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ferdjuan  
View profile
 More options May 18, 2:27 am
From: ferdjuan <afr...@gmail.com>
Date: Sat, 17 May 2008 23:27:27 -0700 (PDT)
Local: Sun, May 18 2008 2:27 am
Subject: Re: $.post() not sending info
If this code is verbatim I would suggest some kind of validation in
your php script, with the script you have now anyone could hijack your
database with an sql injection, or anything really. I suggest looking
at: stripslashes(), striptags(), preg_match(), ereg(), trim(), any
validation is better than none :}

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google