Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从AJAX发送到php文件时,如何区分表单数据和jQuery变量?_Php_Jquery_Ajax - Fatal编程技术网

从AJAX发送到php文件时,如何区分表单数据和jQuery变量?

从AJAX发送到php文件时,如何区分表单数据和jQuery变量?,php,jquery,ajax,Php,Jquery,Ajax,我已经使用ajax将表单数据和一个单独的变量发送到一个php文件中。我的问题是如何区分表单数据中的变量和php文件中的变量 $(document).ready(function(){ $(document).on("change", ".analysis_progress_check", function(event) { event.preventDefault(); if (this.checked) { confirm("hello w

我已经使用ajax将表单数据和一个单独的变量发送到一个php文件中。我的问题是如何区分表单数据中的变量和php文件中的变量

  $(document).ready(function(){

    $(document).on("change", ".analysis_progress_check", function(event) {
      event.preventDefault();
      if (this.checked) {
        confirm("hello world");

        var form = $(this).closest('form').serialize();
        var this_analysis_number = $(this).closest("form").find("input[name='analysis_number']").val();
        var data = form + '&' + this_analysis_number;

        $(".test").val(this_analysis_number);

        $.ajax({
          type: "POST",
          url: "../server/insert_analyses.php?submit_analysis",
          data: data,
          success: function(message) {
            $('#success').html(message).fadeIn('fast').delay(3000).fadeOut('slow');

          }
        });
      }
    });
  });
php示例:

if (isset($_GET['submit_analysis'])) {
    $analysis_id = $_POST['analysis_id']; //from form
    $this_analysis_number = $_POST['this_analysis_number']; //from variable


    echo $this_analysis_number;
}

此\u分析\u编号
需要一个参数

var data = form + '&this_analysis_number=' + this_analysis_number;

首先查看
var data=form+'&这个分析数='+这个分析数完美,不知道怎么做!回答一下,我就接受!