client Ajax Call with Webservice
function get_config_info() {
var ret = {
'no_promotions': true,
'web_match': true,
'target_property_count': 15,
'max_properties': 100,
'max_units_total': 70,
'eci': true
}
var JsonServiceURL = '/CCSales/Services/CommonService.asmx';
var url = JsonServiceURL + "/GetConfigurationDetails";
//alert(JSON.stringify(jsonInput));
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: url,
async: false,
data: JSON.stringify({ configId: 1, CallConID: get_onyx_info().call_con_id }),
success: function (data_result) {
var data = $.parseJSON(data_result);
try {
//var config_vars = new window.top.oCallVars();
ret = {
'no_promotions': data.Response.Configuration.NoPromotions || '',
'web_match': data.Response.Configuration.WebMatch || '',
'target_property_count': data.Response.Configuration.TargetPropertyCount || '',
'max_properties': data.Response.Configuration.MaxProperties || '',
'max_units_total': data.Response.Configuration.MaxUnitsTotal || '',
'eci': data.Response.Configuration.ECI || ''
}
} catch (err) { }
},
error: function (data_result) {
ret = {
'no_promotions': true,
'web_match': true,
'target_property_count': 15,
'max_properties': 100,
'max_units_total': 70,
'eci': true
}
}
});
return ret;
}
/* END LOOKUPS */
Add object to Cookie
/* BEGIN PAGE LOAD CODE */
function store_config_details() {
if (!is_page_unloading) {
log('storing config_info');
}
var vget_config_info = get_config_info();
new CookieHandler().setCookie('get_config_info', window.escape_once($.toJSON({
'no_promotions': vget_config_info.no_promotions,
'web_match': vget_config_info.web_match,
'target_property_count': vget_config_info.target_property_count,
'max_properties': vget_config_info.max_properties,
'max_units_total': vget_config_info.max_units_total,
'eci': vget_config_info.eci
})));
}
Get object from cookie
$(document).ready(function () {
store_config_details();
var raw_jsonconfig = replace_all(window.unescape(new CookieHandler().getCookie('get_config_info')), '+', ' ');
});
No comments:
Post a Comment