【发布时间】:2018-12-23 07:07:15
【问题描述】:
我有旧代码,它有 jquery v1.9。 现在进行一些新的编辑,我需要提交表单而不使用 ajax 刷新页面。但它不起作用。 当我更改 jquery 的版本时,旧脚本不起作用。 我的代码在这里: 天.php:
<script>
$(document).ready(function(){
$('#formSubmit').click(function(){
$.post("day2.php",
{name: $('#name').val()},
function(data){
$('#response').html(data);}
);});});
</script>
<div>
<input type="text" id="name">
<button id="formSubmit">send</button>
<textarea id="response"></textarea>
</div>
和day2.php:
$name = $_POST['name'];
echo "response: " +$name;
我不知道问题出在哪里!
【问题讨论】:
-
PHP 中的字符串连接是
.而不是+
标签: php jquery ajax forms form-submit