• 0

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

problem with corss domain ajax post request return 401 error

I have a problem with ajax post authorization I have my web app on address https://example.app.com and i have api app on address https://example.app.com:900. When I call form Web App through js file to Api App i get 401 Unauthorized error. I added in web.config file configuration for cors (customHeaders)


My js function:

    xml = '' +             '<' +fn + ' xmlns="http://www.5555.com/ns/">' +query + '';     $.ajax({         type: "POST",         url: window.location.protocol + '//' + window.location.hostname + ':900/XXX.asmx',         data: xml,         contentType: "text/xml; charset=utf-8",         crossDomain: true,         dataType: "xml",         xhrFields: { withCredentials: true },         success: function (data, status, jqXHR) {             alert("OK")         },         error: function (jqXHR, status) {             alert(status);             alert(jqXHR);         }     }); 
Download script demo [LINK] [Origin]
Download script demo [LINK 2] [Onedrive] Download script demo [LINK 2] [Google drive]