Trouble with $.post

I am trying to insert some values into an sql database.

I am using

<input type="text" name="message" id="message"  />
<input type="image" src="boca.png" onClick="send();" />

to get the value and

function send(){

var mess = $('#message').val('');   
var dataString = 'message:'+ mess;  
$.ajax({  
  type: "POST",  
  url: "atuamae.org/send.php",  
  data: dataString,  
  success: function() {  
    $('#message').val('');
  }  
});  }

to send it to the php file and in the php file:

$message = $_GET['message'];

I think the error occurs either in sending or in the way the var dataString is encoded

Answers


Simply enough, you're using the HTTP POST method, not the HTTP GET method, so you need to use $_POST rather than $_GET on the PHP side.


Need Your Help

UITableView fixed header

iphone objective-c uitableview uiscrollview header

How to disable scrolling for UITableView header, to be always visible? (To have column titles.)

NodeJS and Express interceptors

node.js express interceptor

I'm trying to code an interceptor for metrologie purpose. My interceptor must be called before any http query (and before Express does its job) to put some time informations and after Express's job...

How to work with upgrade (not update) of an Application in iOS?

ios app-store in-app-purchase upgrade

This is the first time i am trying to create an application in which money in involved . I will give premium some features to user once he pays on the apple store.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.