2 Replies Latest reply on Sep 10, 2015 2:08 PM by Zsolt Zsombor

    SB1 ajax POST

    Zsolt Zsombor

      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: <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> \n<html xmlns=\"http://www.w3.org/1999/xhtml\"> \n<head> \n<title>IIS 8.5 Detailed Error - 412.0 - Precondition Failed</title> \n<style type=\"text/css\"> \n<!-- \nbody{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;} \ncode{margin:0;color:#006600;font-size:1.1em;font-weight:bold;} \n.config_source code{font-size:.8em;color:#000000;} \npre{margin:0;font-size:1.4em;word-wrap:break-word;} \nul,ol{margin:10px 0 10px 5px;} \nul.first,ol.first{margin-top:5px;} \nfieldset{padding:0 15px 10px 15px;word-break:break-all;} \n.summary-container fieldset{padding-bottom:5px;margin-top:4px;} \nlegend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;} \nlegend{color:#333333;;margin:4px 0 8px -12px;_margin-top:0px; \nfont-weight:bold;font-size:1em;} \na:link,a:visited{color:#007EFF;font-weight:bold;} \na:hover{text-de

       

      It works from Firefox on my laptop.

       

      Thanks for any help!

      Zsolt