Server error:429, when create_customer via AJAX

Solved
Highlighted
Shopify Partner
29 4 4

Dear all,

I am struck with following issue. please help me to resolve it.

I am trying to create customer account via following AJAX call from my login.liquid file. The AJAX response i am getting as

{"readyState":4,"responseText":"","status":429,"statusText":"error"}

 

My AJAX request as follows.(Along with this code, my "create_customer" and "customer_login"  forms also exist in the same file)

 

var customerdata = {
'customer[email]': "shriba@gmail.com",
'customer[password]': "edy123",
'customer[first_name]': "ponmahes",
'customer[last_name]': "kumar",
'form_type': 'create_customer',
'utf8' : '✓'
};

$.ajax({
url: "/account",
type: "POST",
data: customerdata,
dataType: 'json',
beforeSend: function(x) {
if (x && x.overrideMimeType) {
x.overrideMimeType("application/j-son;charset=UTF-8");
}
},
success: function(result) {

alert("SUCCESS:"+result);
window.location.href = "/account";
}, error: function(jqXHR, textStatus, errorThrown) {
alert("FAIL:"+textStatus+"::jqXHR:"+JSON.stringify(jqXHR)+"::Error Thrown:"+errorThrown);
console.log("jqXHR Error:"+JSON.stringify(jqXHR));
}
});

 

 

Please at least, let me know the root cause of the issue. 

 

Thanks in advance!.

 

Regards,

Pon maheswaran K

0 Likes
Highlighted
Shopify Partner
29 4 4

This is an accepted solution.

Dear all,

By calling following method in "beforeSend: function(x)"  resolved this 429 server issue.

 

x.setRequestHeader("application/j-son;charset=UTF-8");
x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

 

Thanks & regards,

Pon maheswaran K

0 Likes