skip to Main Content

AJAX Data with Dynamic form fields name – Jquery ajax

Hello how can can make my ajax data call to be dynamic, I tried this var opt_name = $(".NAME").data('opt_name'); var opt_business = $(".BUSINESS").data('opt_business'); var opt_phone = $(".PHONE").data('opt_phone'); var opt_email = $(".EMAIL").data('opt_email'); var opt_unique_name=$(".UNIQUE_NAME").data('opt_unique_name'); var opt_name_val = $(".NAME")[key].value; var opt_business_val =…

VIEW QUESTION

jQuery ajax parameters not being passed to php as expected

I have the following javaScript code: const getReport = { jobID: $('#jobID').val(), startDate: $('#summaryStart').val(), endDate: $('#summaryEnd').val(), tableType: 'Summary', }; $.ajax({ url: "php/reports.php", contentType: "application/json", type: "post", dataType: "application/json", data: function (d) { return JSON.stringify(getReport); }, success: function (response) { if…

VIEW QUESTION
Back To Top
Search