Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.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
我已经在javascript中获得了ajax响应,但现在我想提交表单,并希望ajax响应也在我的POST数组中_Javascript_Php_Jquery_Ajax_Forms - Fatal编程技术网

我已经在javascript中获得了ajax响应,但现在我想提交表单,并希望ajax响应也在我的POST数组中

我已经在javascript中获得了ajax响应,但现在我想提交表单,并希望ajax响应也在我的POST数组中,javascript,php,jquery,ajax,forms,Javascript,Php,Jquery,Ajax,Forms,我想在数据库中添加数据,我想在POST数组中也添加ajax响应数组,但还没有这样做 <div class="form-group"> <label for="focusedinput" class="col-sm-2 control-label">Campus Accreditation</label> <div class="col-sm-7"> <?php Web_Interface::load_accreditation

我想在数据库中添加数据,我想在POST数组中也添加ajax响应数组,但还没有这样做

<div class="form-group">
  <label for="focusedinput" class="col-sm-2 control-label">Campus Accreditation</label>
  <div class="col-sm-7">
    <?php Web_Interface::load_accreditation($obj_admin->adminCountry); ?>
    <script>
      jQuery("input[id=accreditation]").click(function() {
        var selectedCheckBoxArray = new Array();
        var n = jQuery("input[id=accreditation]:checked").length;
        if (n > 0) {
          jQuery("input[id=accreditation]:checked").each(function() {
            selectedCheckBoxArray.push($(this).val());
          });
          //send check box data value array to server using Ajax
          var data = {
            myCheckboxes: selectedCheckBoxArray
          };
          jQuery.ajax({
            url: "../process/ProcessAjaxChecking.php",
            data: data,
            type: "POST",
            success: function(data) {
              $('#getAcademics').html(data);
              $json = json_encode(data);
              $.ajax({
                url: "Example.php",
                type: "POST",
                dataType: "json",
                success: function(msg) {
                  $('#getAcademics').html(data);
                }
              });
            }
          });

        }
      });
    </script>
  </div>

校园认证
jQuery(“输入[id=认证]”)。单击(函数(){
var selectedCheckBoxArray=新数组();
var n=jQuery(“输入[id=accreditation]:选中”)。长度;
如果(n>0){
jQuery(“输入[id=认证]:选中”)。每个(函数(){
selectedCheckBoxArray.push($(this.val());
});
//使用Ajax将复选框数据值数组发送到服务器
风险值数据={
我的复选框:selectedCheckBoxArray
};
jQuery.ajax({
url:“../process/ProcessAjaxChecking.php”,
数据:数据,
类型:“POST”,
成功:功能(数据){
$('#getAcademics').html(数据);
$json=json_编码(数据);
$.ajax({
url:“Example.php”,
类型:“POST”,
数据类型:“json”,
成功:功能(msg){
$('#getAcademics').html(数据);
}
});
}
});
}
});
提交表格前

从提交后

在your value.php中,您命名为'academicsCheckBoxes
,在ajax中命名为'academicsCheckBoxes
myCheckboxes'

改变

var data = {
    academicsCheckBoxes: selectedCheckBoxArray 
};
<div class="form-group">
  <label for="focusedinput" class="col-sm-2 control-label">Campus Accreditation</label>
  <div class="col-sm-7">
    <?php Web_Interface::load_accreditation($obj_admin->adminCountry); ?>
    <script>
      jQuery("input[id=accreditation]").click(function() {
        var selectedCheckBoxArray = new Array();
        var n = jQuery("input[id=accreditation]:checked").length;
        if (n > 0) {
          jQuery("input[id=accreditation]:checked").each(function() {
            selectedCheckBoxArray.push($(this).val());
          });
          //send check box data value array to server using Ajax
          var data = {
            academicsCheckBoxes: selectedCheckBoxArray 
          };
          jQuery.ajax({
            url: "../process/ProcessAjaxChecking.php",
            data: data,
            type: "POST",
            success: function(data) {
              $('#getAcademics').html(data);
              $json = json_encode(data);
              $.ajax({
                url: "Example.php",
                type: "POST",
                dataType: "json",
                success: function(msg) {
                  $('#getAcademics').html(data);
                }
              });
            }
          });

        }
      });
    </script>
  </div>
更新代码

var data = {
    academicsCheckBoxes: selectedCheckBoxArray 
};
<div class="form-group">
  <label for="focusedinput" class="col-sm-2 control-label">Campus Accreditation</label>
  <div class="col-sm-7">
    <?php Web_Interface::load_accreditation($obj_admin->adminCountry); ?>
    <script>
      jQuery("input[id=accreditation]").click(function() {
        var selectedCheckBoxArray = new Array();
        var n = jQuery("input[id=accreditation]:checked").length;
        if (n > 0) {
          jQuery("input[id=accreditation]:checked").each(function() {
            selectedCheckBoxArray.push($(this).val());
          });
          //send check box data value array to server using Ajax
          var data = {
            academicsCheckBoxes: selectedCheckBoxArray 
          };
          jQuery.ajax({
            url: "../process/ProcessAjaxChecking.php",
            data: data,
            type: "POST",
            success: function(data) {
              $('#getAcademics').html(data);
              $json = json_encode(data);
              $.ajax({
                url: "Example.php",
                type: "POST",
                dataType: "json",
                success: function(msg) {
                  $('#getAcademics').html(data);
                }
              });
            }
          });

        }
      });
    </script>
  </div>

校园认证
jQuery(“输入[id=认证]”)。单击(函数(){
var selectedCheckBoxArray=新数组();
var n=jQuery(“输入[id=accreditation]:选中”)。长度;
如果(n>0){
jQuery(“输入[id=认证]:选中”)。每个(函数(){
selectedCheckBoxArray.push($(this.val());
});
//使用Ajax将复选框数据值数组发送到服务器
风险值数据={
Academics复选框:selectedCheckBoxArray
};
jQuery.ajax({
url:“../process/ProcessAjaxChecking.php”,
数据:数据,
类型:“POST”,
成功:功能(数据){
$('#getAcademics').html(数据);
$json=json_编码(数据);
$.ajax({
url:“Example.php”,
类型:“POST”,
数据类型:“json”,
成功:功能(msg){
$('#getAcademics').html(数据);
}
});
}
});
}
});

在your value.php中,您命名为'academicsCheckBoxes
,在ajax中命名为'academicsCheckBoxes
myCheckboxes'

改变

var data = {
    academicsCheckBoxes: selectedCheckBoxArray 
};
<div class="form-group">
  <label for="focusedinput" class="col-sm-2 control-label">Campus Accreditation</label>
  <div class="col-sm-7">
    <?php Web_Interface::load_accreditation($obj_admin->adminCountry); ?>
    <script>
      jQuery("input[id=accreditation]").click(function() {
        var selectedCheckBoxArray = new Array();
        var n = jQuery("input[id=accreditation]:checked").length;
        if (n > 0) {
          jQuery("input[id=accreditation]:checked").each(function() {
            selectedCheckBoxArray.push($(this).val());
          });
          //send check box data value array to server using Ajax
          var data = {
            academicsCheckBoxes: selectedCheckBoxArray 
          };
          jQuery.ajax({
            url: "../process/ProcessAjaxChecking.php",
            data: data,
            type: "POST",
            success: function(data) {
              $('#getAcademics').html(data);
              $json = json_encode(data);
              $.ajax({
                url: "Example.php",
                type: "POST",
                dataType: "json",
                success: function(msg) {
                  $('#getAcademics').html(data);
                }
              });
            }
          });

        }
      });
    </script>
  </div>
更新代码

var data = {
    academicsCheckBoxes: selectedCheckBoxArray 
};
<div class="form-group">
  <label for="focusedinput" class="col-sm-2 control-label">Campus Accreditation</label>
  <div class="col-sm-7">
    <?php Web_Interface::load_accreditation($obj_admin->adminCountry); ?>
    <script>
      jQuery("input[id=accreditation]").click(function() {
        var selectedCheckBoxArray = new Array();
        var n = jQuery("input[id=accreditation]:checked").length;
        if (n > 0) {
          jQuery("input[id=accreditation]:checked").each(function() {
            selectedCheckBoxArray.push($(this).val());
          });
          //send check box data value array to server using Ajax
          var data = {
            academicsCheckBoxes: selectedCheckBoxArray 
          };
          jQuery.ajax({
            url: "../process/ProcessAjaxChecking.php",
            data: data,
            type: "POST",
            success: function(data) {
              $('#getAcademics').html(data);
              $json = json_encode(data);
              $.ajax({
                url: "Example.php",
                type: "POST",
                dataType: "json",
                success: function(msg) {
                  $('#getAcademics').html(data);
                }
              });
            }
          });

        }
      });
    </script>
  </div>

校园认证
jQuery(“输入[id=认证]”)。单击(函数(){
var selectedCheckBoxArray=新数组();
var n=jQuery(“输入[id=accreditation]:选中”)。长度;
如果(n>0){
jQuery(“输入[id=认证]:选中”)。每个(函数(){
selectedCheckBoxArray.push($(this.val());
});
//使用Ajax将复选框数据值数组发送到服务器
风险值数据={
Academics复选框:selectedCheckBoxArray
};
jQuery.ajax({
url:“../process/ProcessAjaxChecking.php”,
数据:数据,
类型:“POST”,
成功:功能(数据){
$('#getAcademics').html(数据);
$json=json_编码(数据);
$.ajax({
url:“Example.php”,
类型:“POST”,
数据类型:“json”,
成功:功能(msg){
$('#getAcademics').html(数据);
}
});
}
});
}
});

value.php是您试图获取请求数据的php脚本文件吗?postValue.php是我刚刚检查AJAX POST ARRAYIs value的文件。php是您试图获取请求数据的php脚本文件吗?postValue.php是我刚刚检查AJAX POST Array的文件。这是postValue.php,但这个postValue.php没有与此Bro连接没有连接*但您在postValue.php中遇到错误并高亮显示它。这是postValue.php但此postValue.php没有与此Bro连接没有连接*但您在postValue.php中遇到错误并高亮显示它。