Click here to Skip to main content
15,392,472 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: 8yr JS now giving me console error in FF and CHROME Pin
Richard Deeming12-Apr-21 3:39
mveRichard Deeming12-Apr-21 3:39 
GeneralRe: 8yr JS now giving me console error in FF and CHROME Pin
Member 1514660812-Apr-21 4:00
MemberMember 1514660812-Apr-21 4:00 
QuestionKendo UI for jQuery Combobox noDataTemplate Not Loading Pin
Hypermommy5-Apr-21 9:35
MemberHypermommy5-Apr-21 9:35 
Questionquirks with use of Audio() Pin
Derell Licht31-Mar-21 16:03
professionalDerell Licht31-Mar-21 16:03 
QuestionBizarre JSON parse problem Pin
intoittendenz28-Mar-21 23:27
Memberintoittendenz28-Mar-21 23:27 
AnswerRe: Bizarre JSON parse problem Pin
Richard Deeming29-Mar-21 0:36
mveRichard Deeming29-Mar-21 0:36 
QuestionCreating a JSON body payload in plain JavaScript Pin
jkirkerx27-Mar-21 9:46
professionaljkirkerx27-Mar-21 9:46 
AnswerRe: Creating a JSON body payload in plain JavaScript [solved] Pin
jkirkerx27-Mar-21 10:52
professionaljkirkerx27-Mar-21 10:52 
I went back and did more research.
The payload I sent from my JavaScript fetch was empty, so PHP wasn't able to read anything, or work with the JSON.
Found some technical documentation for fetch, and there is a correct way to attach the payload for PHP V7.4+ to read using $jsonPayload = file_get_contents('php://input');

Changing the header to an object and inserting the object into fetch seems to have packaged my payload proper for a smooth transmission. So that's it, I now have all my parts designed, tested and confirmed and it appears to be really fast and rock solid now. I'm off to the pool to hang out.
const jsonData = {
    "projectNumber": projectNoElement.value,
    "userName" : userNameElement.value,
    "userType" : userTypeElement.value,
    "invoiceClass": classElement.value,
    "invoiceOperation": opElement.value,
    "subContractor": scElement.value,
    "invoiceDate": dateElement.value,
    "invoiceNumber": invNumberElement.value.trim(),
    "invoiceAmount": invAmountElement.value.trim(),
    "invoiceDescription": descElement.value.trim()
};

const jsonPayload = JSON.stringify(jsonData);

// Diagnostics
// console.log(jsonPayload);

let header = new Headers();
header.append('Content-Type', 'application/json');
header.append('Accept', 'application/json');

fetch(urlQuery, { mode: 'same-origin', method: 'POST', cache: 'no-cache', headers: header, body: jsonPayload })
If it ain't broke don't fix it
Discover my world at jkirkerx.com

GeneralRe: Creating a JSON body payload in plain JavaScript [solved] Pin
intoittendenz29-Mar-21 1:01
Memberintoittendenz29-Mar-21 1:01 
QuestionCannot figure out what code lines does mean ... Pin
Member 1501261727-Mar-21 0:01
MemberMember 1501261727-Mar-21 0:01 
AnswerRe: Cannot figure out what code lines does mean ... Pin
Member 1501261727-Mar-21 0:03
MemberMember 1501261727-Mar-21 0:03 
AnswerRe: Cannot figure out what code lines does mean ... Pin
Peter_in_278027-Mar-21 0:54
professionalPeter_in_278027-Mar-21 0:54 
GeneralRe: Cannot figure out what code lines does mean ... Pin
Member 1501261727-Mar-21 21:40
MemberMember 1501261727-Mar-21 21:40 
GeneralRe: Cannot figure out what code lines does mean ... Pin
Member 150126178-Apr-21 22:49
MemberMember 150126178-Apr-21 22:49 
AnswerRe: Cannot figure out what code lines does mean ... Pin
Richard Deeming28-Mar-21 22:29
mveRichard Deeming28-Mar-21 22:29 
GeneralRe: Cannot figure out what code lines does mean ... Pin
Member 150126178-Apr-21 22:49
MemberMember 150126178-Apr-21 22:49 
QuestionRedirect with (Page Visibility API) Pin
ab smine19-Mar-21 10:38
Memberab smine19-Mar-21 10:38 
QuestionNode-Schedule Module Can't Cron Job Scheduled Long Time Pin
Barış KAHRAMAN19-Mar-21 10:02
MemberBarış KAHRAMAN19-Mar-21 10:02 
QuestionCalculation in javascript Pin
Krasimir Dermendzhiev16-Mar-21 3:31
MemberKrasimir Dermendzhiev16-Mar-21 3:31 
AnswerRe: Calculation in javascript Pin
Richard Deeming16-Mar-21 4:39
mveRichard Deeming16-Mar-21 4:39 
GeneralRe: Calculation in javascript Pin
Krasimir Dermendzhiev16-Mar-21 21:36
MemberKrasimir Dermendzhiev16-Mar-21 21:36 
GeneralRe: Calculation in javascript Pin
Krasimir Dermendzhiev30-Mar-21 4:22
MemberKrasimir Dermendzhiev30-Mar-21 4:22 
QuestionJavascript CSP and CORS problem? How can I send Cookies with AJAX in CORS? Pin
Member 1510027614-Mar-21 21:50
MemberMember 1510027614-Mar-21 21:50 
AnswerRe: Javascript CSP and CORS problem? How can I send Cookies with AJAX in CORS? Pin
Richard Deeming14-Mar-21 22:39
mveRichard Deeming14-Mar-21 22:39 
GeneralRe: Javascript CSP and CORS problem? How can I send Cookies with AJAX in CORS? Pin
Member 1510027614-Mar-21 23:11
MemberMember 1510027614-Mar-21 23:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.