$.ajax({
type: "POST",
url: "/products/importlist/posttoshop/",
data: JSON.stringify(product_post_data),
beforeSend: function (xhr) {
xhr.setRequestHeader("X-CSRFToken", getCookie("csrftoken"));
},
contentType: "json",
success: function (data) {
console.log("SUCCESS");
console.log(data);
switch (data["result"]){
case "success":
// success action
break;
case "error":
// error action
}
},
error: function () {
// Request failed and error
}
})