Skip to content

Commit

Permalink
quick fix sendin
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasPrt committed Nov 24, 2021
1 parent 07dc530 commit deed9be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion assets/js/classes/AJAXRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export class AJAXRequest {
this.endpoint = endpoint;
this.method = method;
this.body = body;
this.contentType = contentType;
if (contentType == null) {
this.contentType = 'application/x-www-form-urlencoded';
} else {
this.contentType = contentType;
}
}

/**
Expand Down
3 changes: 1 addition & 2 deletions assets/js/classes/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class Form {
this.responses[this.responseNumber] = await response.json();

// TODO: change this when I have time
if (document.querySelector("#googleform > input[type=hidden]:nth-child(2)").value != "googleform") {
if (document.querySelector("#" + this.formID + " > input[type=hidden]:nth-child(2)").value != "googleform") {
this.loadingScreen.stop();
} else {
this.loadingScreen.setMessage(this.responses[this.responseNumber].data);
Expand All @@ -180,7 +180,6 @@ export class Form {
errorElement.style.display = 'block';
errorElement.style.width = '100%';
errorElement.classList.add('visible');
console.error(message);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion template-parts/form-sendin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
) );
?>

<form class="section__content form multistepform" id="sendin" data-admin-url="<?php echo admin_url( 'admin-ajax.php' ); ?>" enctype="multipart/form-data">
<form class="section__content form multistepform" id="sendin" data-admin-url="<?php echo admin_url( 'admin-ajax.php' ); ?>">

<input type="hidden" name="type_of_inquiry" value="SendinDevice">
<input type="hidden" name="action" value="sendin">
Expand Down

0 comments on commit deed9be

Please sign in to comment.