Jump to content

Ajax failing with 406


danjapro

Recommended Posts

Please help with this, it not going to the .html controller and returing the values need, it captures the email form values, bu then fails with a 406 error.

 

Please help 

 

 

 
 $('#newsletter').submit(function() {
     //E-mail is passed
    var values = $(this).serialize();
var formRef = $('form').attr('id'); 
var dataString = JSON.stringify(values);
//var values = $("#newsletter_email").val();
        if($('#newsletter_tc_check').is(':checked')){
         $.ajax({
         type: 'POST',
         url: "./saveNewsletterSignupEmailPost.html",
         dataType: 'json',
         data: dataString,
         contentType: 'application/json',
           mimeType: 'application/json',
           success: function(data) {
                    var result = $.parseJSON(data);
                    if(result.form == formRef){
                        $('.success.message').contents().find('h4').text(success.text());
                         VanillaReload.notify.showNotification("success");
                        $("#newsletter_email").val("");
                    }else{
$('.error.message').contents().find('h4').text(error.text());
VanillaReload.notify.showNotification(".error"); 
                    }
                }
             });
            return false;
        }else{
       $('.error.message').contents().find('h4').text(error.text());
vanillaeGift.notify.showNotification(".error");
        }
        return false;
 
}); 
 
 
Link to comment
https://forums.phpfreaks.com/topic/291166-ajax-failing-with-406/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.