pRieStaKos Posted September 29, 2020 Share Posted September 29, 2020 (edited) Hello, I would like to post a form action with $.ajax, to modules/addons/custom_folder/actions/setup.php&id={$service.id} but i get 404 error, on submit. If I set the form to post to action="clientarea.php?action=productdetails&id={$service.id}" the form is submitted successfully. <form id="setupForm[{$service.id}]" action="modules/addons/custom_folder/actions/setup.php&sid={$service.id}" index="setupForm" method="post"> </form> $(document).on('click', 'button.submitForm', function(event){ event.preventDefault(); $(this).button('loading'); var form = $(this.form); var indexes = ['reinstallForm', 'consoleButton']; if ($.inArray(form.attr('index'), indexes) !== '-1') { var formData = $(form).serializeArray() var formObj = {} $.each(formData, function (i, input) { formObj['formData[' + input.name + ']'] = input.value; }); } $.ajax({ url: form.attr('action') + '&loadData=' + form.attr('index') + '&namespace=' + form.attr('namespace') + '&index=' + form.attr('index'), type: form.attr('method'), processData: false, contentType: false, data: (jQuery.inArray(form.attr('index'), indexes) !== ' -1') ? jQuery.param(formObj) : $(form).serialize() }).done(function (data) { table.column(5).search("Active").draw(); $('button.submitForm').button('reset').closest('.modal.in').modal('toggle'); if(indexes == 'activateConsoleForm') { checkStatus(); } else { data = data.data if (data.status === 'success') { addAlert(data.status, data.message) setTimeout(function () { // wait for 5 secs location.reload(); // then reload the page. }, 5000); } else { addAlert(data.status, data.message) } } }); }); Any suggestions ? Edited September 29, 2020 by pRieStaKos 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted October 1, 2020 Author Share Posted October 1, 2020 Hello, Issue has been resolved. I just noticed a silly mistake on the action URL. I set `&` instead of `?` in the parameters: action="modules/addons/custom_folder/actions/setup.php&sid={$service.id}" - action="modules/addons/custom_folder/actions/setup.php?sid={$service.id}" 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.