Search code examples
jqueryajaxsubmit

what is worng in ajaxSubmit calling?


$scope.submitTheForm = function(htmlcode){  
        var idOfForm = "formOfCalCPDF";
        var dataPassed = $.param({'htmlcode':htmlcode,'mode':'getpdf'});
        alert("coming here");
        $(idOfForm).ajaxSubmit({
            url: 'ggs.erm.payrollJava.Taxsummary',
            type: "POST",
             data: dataPassed,
            error:function (){},
            success: function (data){}
        });
    };

When ever I call this function , although alert is executing,but not POST request, do you see any kind of problem with it?


Solution

  • You forgot id selector try this:-

    $scope.submitTheForm = function(htmlcode){  
        var idOfForm = "formOfCalCPDF";
        var dataPassed = $.param({'htmlcode':htmlcode,'mode':'getpdf'});
        alert("coming here");
        $('#'+idOfForm).ajaxSubmit({
            url: 'ggs.erm.payrollJava.Taxsummary',
            type: "POST",
             data: dataPassed,
            error:function (){},
            success: function (data){}
        });
    };