简单的jQuery发布不适用于Internet Explorer 9(访问被拒绝) [英] Simple jQuery post not working on Internet Explorer 9 (access denied)
本文介绍了简单的jQuery发布不适用于Internet Explorer 9(访问被拒绝)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用JQuery和PHP编写了一个验证程序,该验证程序可在除Internet Explorer 9之外的所有浏览器中使用.我收到错误消息"SCRIPT5:访问被拒绝".
I programmed a validator with JQuery and PHP that works in all browsers except Internet Explorer 9. I get the error message "SCRIPT5: Access denied".
jQuery代码
$('#contact-send').click(function(){
$.post('functions/db-contact.php',{
contact_name: $('#contact-name').val(),
contact_email: $('#contact-email').val(),
contact_subject: $('#contact-subject').val(),
contact_message: $('#contact-message').val()
},
function(x){
console.log(x);
}
});
这是响应(x):
<?xml version="1.0"?>
<response>
<mail>
<name>1</name>
<email>1</email>
<subject>1</subject>
<message>1</message>
<status>notok</status>
</mail>
</response>
SCRIPT5: Access denied
我真的不知道可能是什么错误.我添加了数据库联系人文件. @Brad:)
I really have no idea what can be the error. I added the DB contact file. @Brad :)
<?php
include 'db_login.php';
$name = mysql_escape_string($_POST['contact_name']);
$email = mysql_escape_string($_POST['contact_email']);
$subject = mysql_escape_string($_POST['contact_subject']);
$message = mysql_escape_string($_POST['contact_message']);
echo "<?xml version=\"1.0\"?>\n";
echo "<response>\n";
echo "\t<mail>\n";
$i = 0;
if($name == 'type your name' or $name == '' or strlen(trim($name)) == 0){
echo "\t\t<name>1</name>\n";
$i = 1;
}
if($email == 'type your email address' or $email == '' or strlen(trim($email)) == 0){
echo "\t\t<email>1</email>\n";
$i = 1;
}
if($subject == 'type subject' or $subject == '' or strlen(trim($subject)) == 0){
echo "\t\t<subject>1</subject>\n";
$i = 1;
}
if($message == 'type your message on us'
or $message == '' or strlen(trim($message)) == 0){
echo "\t\t<message>1</message>\n";
$i = 1;
}
if($i == 1){
echo "\t\t<status>notok</status>\n";
echo "\t</mail>\n";
echo "</response>";
return false;
}
$sql = "INSERT INTO `d013f578`.`mail` (`id`, `name`, `email`, `subject`, `message`)
VALUES (NULL, '".$name."', '".$email."', '".$subject."', '".$message."');";
$query = mysql_query($sql) or die;
echo "\t\t<status>ok</status>\n";
echo "\t</mail>\n";
echo "</response>";
?>
不幸的是,我在互联网上找不到任何可用的提示.
Unfortunately I have not found any usable tip on the internet.
推荐答案
所以,我有100%的解决方案. 取而代之的是jQuery 1.8,我使用的是jQuery 1.6.4,因此该问题不再可用!
So, I have 100% the solution. Instead jquery 1.8, I'm using jquery 1.6.4 and the problem was thus no longer available!
这篇关于简单的jQuery发布不适用于Internet Explorer 9(访问被拒绝)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文