how knockout js communicate with rest services window.pcx.global = { baseUrl : "http://localhost:2000/ restservicesURL " , contentType : "application/json; charset=utf-8" , dataType : "json" } var setHeaderRequest = function (xhr, companyId) { xhr.setRequestHeader( "CompanyID" , companyId); } var ajaxAsynch = function (url, data, CallType, callback) { var global = window.pcx.global; $.ajax({ url: global.baseUrl + url, cache: false , beforeSend: function (xhr) { setHeaderRequest(xhr, "1"); }, type: CallType, contentType: global.contentType, data: JSON.stringify(data), dataType: global.dataType, success: function (data) { if (data !== undefined && data !== null ) { //TODO: Sucess logic.
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers