通过AJAX POST到PHP无法正常工作 [英] POST to PHP via AJAX not working

查看:69
本文介绍了通过AJAX POST到PHP无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行此错误



我收到错误:



注意:未定义的索引:名称在第2行的C:\ xampp \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 $( document ).ready( function () {
$ .post( submitposY.php
{
posY: test
})
$( #posY)。load( submitposY.php
});



这是submitposY.php中的PHP

 <?php  <   br     mode   = 按住    /? >  
$ a = $ _POST ['posY'];
echo $ a;
?>



我有一个id为posY的div。

解决方案

document ).ready( function (){


.post ( submitposY.php
{
posY: test
})


#posY)。load( submitposY.php
});



这是在submitposY.php中的PHP

 <?php  <   br     mode   =   hold    /? >  

Hi when I run this error

I get the error:

Notice: Undefined index: name in C:\xampp\htdocs\Heads_in_the_clouds\submitposY.php on line 2

I don't know what's wrong.

$( document ).ready(function() {
$.post("submitposY.php",
{
posY: "test"
})
$( "#posY" ).load( "submitposY.php" )
});


This is the PHP in submitposY.php

<?php <br mode="hold" /?>
$a = $_POST['posY'];
echo $a;
?>


I have a div with the id of posY.

解决方案

( document ).ready(function() {


.post("submitposY.php", { posY: "test" })


( "#posY" ).load( "submitposY.php" ) });


This is the PHP in submitposY.php

<?php <br mode="hold" /?>


这篇关于通过AJAX POST到PHP无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆