Wie ich sehen kann, gibt es keine Fehler im Code, aber immer noch zeigt dies SyntaxError: fehlt; vor AnweisungscreenshotMailchimp ajax SyntaxError bei der Formularübergabe
Hier ist die Form:
<form id="bildo_mc_form" action="https://stylishcreativity.us3.list-manage.com/subscribe/post-json?u=7c7040d58ca368b8f8063c1ea&id=f67dfc67a4" method="post">
<input id="mc-email" type="email" name="EMAIL" placeholder="Your Email">
<label for="mc-email"></label>
<button type="submit">Send</button>
</form>
Hier ist die Js:
jQuery("#bildo_mc_form").submit(function(e){
console.log("form submitted");
function callbackFunction(data){
window.location.href = "http://thanks.com";
console.log("sucess result" + data.result);
console.log("sucess msg" + data.msg);
}
var url = jQuery(this).prop('action'); // the script where you handle the form input.
jQuery.ajax({
type: "GET",
url: url,
data: jQuery("#bildo_mc_form").serialize(), // serializes the form's elements.
dataType: "jsonp",
contentType: "application/json; charset=utf-8",
error: function(error){
// According to jquery docs, this is never called for cross-domain JSONP requests
console.log("Error Result" + error.result);
},
success: callbackFunction
});
e.preventDefault(); // avoid to execute the actual submit of the form.
});
Wie kann ich dieses Problem beheben? Pls Hilfe :)
ich Ihren Code in jshint validiert haben, gibt es keine Probleme. Haben Sie [diese ähnliche Frage] überprüft (https://stackoverflow.com/questions/19456146/ajax-call-and-clean-json-but-syntax-error-missing-before-statement)? Dies könnte das gleiche Problem sein. –
Ich habe bereits alle möglichen Korrekturen ausprobiert, die sie auf der ähnlichen Frage erwähnt haben, funktioniert immer noch nicht! Für MailChimp Formular müssen Sie DataType auf JSONP oder das Formular wird nicht http://prntscr.com/ftf6gj –