ajax跨域提交默认get传参 需要后端配置支持post提交
<script> $.ajax({ dataType: 'jsonp', jsonp: 'callback', data: {data:data}, url: url, success: function (data) { console.log(data) }, error: function () { } }) </script>
<?php header('Access-Control-Allow-Origin:*'); //配置跨域支持post提交 $data = $_POST['data']; $msg_arr = ['error' => '0001', 'run' => $data]; return json_encode($msg_arr);
标签:function,跨域,Ajax,提交,post,data From: https://www.cnblogs.com/caopeng/p/17235987.html