SB1 ajax POST

Z Zsolt Zsombor 3 years 6 months ago
6 2 0

Hello Guys,

I'm trying to execute the following ajax request from my SB1 application and it gives me error.
jQuery.ajax({
  type: "POST",
  url : "https://emwstest.globenet.hu/emedworkspraxis/api/User/Post",
  beforeSend: function (xhr) {
    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    xhr.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
  },
  data: { Username:"username" },
  success: function(xhr) {
    // I would like to get here
  },
  error: function(xhr) {
    // I am getting here
  }

Response text is the following: \n \n \nIIS 8.5 Detailed Error - 412.0 - Precondition Failed \n \n

Please Register or Login to post a reply

2 Replies

A Adel Sari

For cross domain requests use jsonp,
see this post

Z Zsolt Zsombor

Hi Adel,

Thanks for the answer!
I could establish a communication with a different server using jsonp. But in my case the server side is not in my hands and it does not support jsonp. Is this the only way to make a successful call?

Thanks,
Zsolt

CONTACT
Can’t find what you’re looking for?