[英]Using $.post with jQuery and php
I'm have a problem with POST in my php script:我的 php 脚本中的 POST 有问题:
`echo` "<script type='text/javascript'>
//<![DATA[
$(document).ready(function()
{
$('.activiteit_vrij').change(function()
{
`var` idv=$(this).val();
`var` dataString = 'idv='+ idv;
$.ajax
({
`type`: 'POST',
`url`: 'ajax/activiteit_vrij_selectie.php',
`data`: dataString,
`cache`: false,
`success`: function(html) { $('.activiteit').html(html); }
});
});
});
//]]>
</script>";
In ajax/activiteit_vrij_selectie.php I pickup the value with: $overdracht = \
$_POST`['idv'];`在 ajax/activiteit_vrij_selectie.php 中,我使用以下命令获取值:
$overdracht = \
$_POST`['idv'];`
It responds with:它回应:
jquery-3.1.0.min.js:4 POST /taakbeheer/ajax/activiteit_vrij_selectie.php 500
jquery-3.1.0.min.js:4 POST /taakbeheer/ajax/activiteit_vrij_selectie.php 500
I cannot find any answer about error 500 In the past it was working fine.我找不到关于错误 500 的任何答案 过去它工作正常。 Usin jQuery jquery-3.6.0.min.js
使用jQuery jquery-3.6.0.min.js
I think I need to use jQuery.post( url [, data ] [, success ] [, dataType ] )
or is it another issue.我想我需要使用
jQuery.post( url [, data ] [, success ] [, dataType ] )
还是另一个问题。 Tried to find any sl试图找到任何 sl
Please try this instead.请改用这个。 There is no need to echo and the backticks are weird
无需回显,反引号很奇怪
?>
<script>
$(function() {
$('.activiteit_vrij').on("change", function() {
const data = { "idv": $(this).val()}
$.post('ajax/activiteit_vrij_selectie.php',data, function(html) {
$('.activiteit').html(html);
});
});
});
</script>
<? .....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.