简体   繁体   English

Ajax无法使用jQuery URL Post方法工作

[英]Ajax not working using jquery url post method

I am trying to make a stepy-form for my project. 我正在尝试为我的项目制作表格。 What I want to do is I want to submit all my data step by step in stepy-form so I used an AJAX request for this purpose, but When I am trying to save it it's not working. 我想要做的是我要逐步以步进形式提交所有数据,因此我为此目的使用了AJAX请求,但是当我尝试保存它时却无法正常工作。 So I used noConflict Method to avoid jQuery conflicts but I still have the same problem. 因此,我使用noConflict方法来避免jQuery冲突,但是我仍然noConflict相同的问题。 I am using adminEX template And Not getting any error message. 我正在使用adminEX模板并且未收到任何错误消息。 So can anyone help me? 有人可以帮我吗?

<script src="ajax/jquery.min.js"></script>
<script>
    $.noConflict();
    Jquery(document).ready(function(){
        $('#stepy_form').click(function(){
            $.ajax({
                type: 'POST',
                url: 'ajax/insert_all.php',
                data: {
                    txtVehicleNo: txtVehicleNo,
                    SltType: SltType,
                    txtPANNumber: txtPANNumber,
                    txtManufacture: txtManufacture,
                    txtModel: txtModel,
                    txtEngineNumber: txtEngineNumber,
                    txtChassisNumber: txtChassisNumber,
                    txtOwnerName: txtOwnerName,
                    txtUnlaidenWt: txtUnlaidenWt,
                    txtGVW: txtGVW
                    //  qid: 'form1'
                },
                //alert('hello');
                //async: true,
                //cache: false,
                success: function(result) {
                    alert('SUCCESS');
                    //$('#target').html(result);
                }
            });
        });
    });
</script>

And this one is the URL ,insert_all.php 这是URL,insert_all.php

$qid = $_POST['qid'];
echo $qid;

You are not using 'no conflict' with jquery and accessing it using $ . 您没有在jquery中使用'no冲突',而是在$访问它。 Change $ with jQuery like this 像这样用jQuery更改$

$.noConflict();
jQuery(document).ready(function(){
    jQuery('#stepy_form').click(function(){
        jQuery.ajax({
            type: 'POST',
            url: 'ajax/insert_all.php',
            data: {
                txtVehicleNo: txtVehicleNo,
                SltType: SltType,
                txtPANNumber: txtPANNumber,
                txtManufacture: txtManufacture,
                txtModel: txtModel,
                txtEngineNumber: txtEngineNumber,
                txtChassisNumber: txtChassisNumber,
                txtOwnerName: txtOwnerName,
                txtUnlaidenWt: txtUnlaidenWt,
                txtGVW: txtGVW
            },
            success: function(result) {
                alert('SUCCESS');
                //$('#target').html(result);
            }
        });
    });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM