什麼都沒有用$。員額的jQuery不會與POST方法發送
function clicked()
{
var $contact_title=$("#contact_title");
var $contact_summary=$("#bbcode");
alert($contact_title.val());// How do I get the contents of the title
alert($contact_summary.val());// How do I get the contents of the textarea
$.post('jquery_send_admin.php',{ title:$contact_title, content:$contact_summary }, function(data){ alert("Message was sent") }, 'html');
}
我得到的例外在我的控制檯error..like以下發下一頁..爲什麼?!?
if(isset($_POST["title"]) && isset($_POST["content"]))
{
$title=mysql_escape_string($_POST["title"]);
$content=mysql_escape_string($_POST["content"]);
$result=mysql_query("INSERT INTO users (query_title,query_message) VALUES(''$title', '$content')") or die(mysql_error());
}
以下錯誤發生:
Error: uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js :: <TOP_LEVEL> :: line 16" data: no]
UPDATE: 那是什麼我從頁,這是由jQuery的觸發要求:
<?php
echo 'outside';
if(isset($_POST["title"]) && isset($_POST["content"]))
{
echo 'inside';
$title=mysql_escape_string($_POST["title"]);
$content=mysql_escape_string($_POST["content"]);
$result=mysql_query("INSERT INTO users (query_title,query_message) VALUES(''$title', '$content')") or die(mysql_error());
}
?>
爲什麼我不明白任何東西放在下一頁?!? –
@DmitryMakovetskiyd,你在說什麼下一頁?你期望在下一頁得到什麼?你究竟得到了什麼? –
在我的更新中,正如你在我的更新中看到的那樣,我試圖插入數據..並且hte警報消息在最後被觸發。爲什麼? –