문제

So with other functions I have on the page I am able to post useing JQuery's $.post. For some reason I can not get this post to send over its parameters. Any idea why?

$(".changeStatus").on("click", function changeStatus(){
                var permissionName  =   $(this).parent().children('.permissionName').val();
                var empId           =   $(this).parent().children('.empId').val();
                var permissionLevel =   Number(($(this).parent().children('.permissionLevel').val())+1);

                if(permissionLevel > 3){permissionLevel = 0;}

                $.post("humanResourceFunctions.php/",
                {
                    command:"changePermissionStatus"
                },
                function(data, status){
                    alert(data);
                });
});

Thank you in advance!

도움이 되었습니까?

해결책

Check if your server returns a 301 or 302 response code if it does then the ajax data is lost due to the redirect (security issue).

"301 Redirects lose contents of the POST. So jQuery is sending it along, but the server redirects it to the right location of the script without the POST data. You need to figure out where the right location of the script is and specify that in your jquery call to avoid the redirect"

다른 팁

Ignore this answer It just reflects the question not having all the parameers shown as the code was pared down for SO. The only reason I didn't delete it is that the comments seemed interesting at the time.


Perhaps you need to put more parameters in the post:

$.post("humanResourceFunctions.php/",
     {
         command:"changePermissionStatus",
         empId: empId,
         ... all the others
     },
     function(data, status){
         alert(data);
     }
);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top