Hi,
I have been trying to use SmartClient with another open source framework (Elgg). Elgg is written in PHP and is a framework for making social network sites.
Current UI of Elgg is not Ajax, where as I want to make my site more Ajax based. I have earlier also used SmartClient and liked it a lot, so thought to use SmartClient frontend and Elgg for backend.
Elgg identifies the client request as Ajax Request by using below function written in Elgg.
// Elgg Function
function elgg_is_xhr() {
return isset($_SERVER['HTTP_X_REQUESTED_WITH'])
&& strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ||
get_input('X-Requested-With') === 'XMLHttpRequest';
}
Problem Statement:
When I send request through SmartClient UI (through any databound component of smartclient), server do not receive _SERVER['HTTP_X_REQUESTED_WITH'] ... as a result Elgg do not consider SmartClient request as AJAX call and returns the full HTML rather than json or xml.
I read on net, most of the AJAX frameworks like YUI, JQuery, EXT etc set _SERVER['HTTP_X_REQUESTED_WITH'] to let server know that the call is AJAX call rather than normal HTTP page request call. Does SmartClient also do the same?
Please let me know how to set _SERVER['HTTP_X_REQUESTED_WITH'] in SmartClient or is there some other way to handle this issue.
Regards,
Gaurav
I have been trying to use SmartClient with another open source framework (Elgg). Elgg is written in PHP and is a framework for making social network sites.
Current UI of Elgg is not Ajax, where as I want to make my site more Ajax based. I have earlier also used SmartClient and liked it a lot, so thought to use SmartClient frontend and Elgg for backend.
Elgg identifies the client request as Ajax Request by using below function written in Elgg.
// Elgg Function
function elgg_is_xhr() {
return isset($_SERVER['HTTP_X_REQUESTED_WITH'])
&& strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ||
get_input('X-Requested-With') === 'XMLHttpRequest';
}
Problem Statement:
When I send request through SmartClient UI (through any databound component of smartclient), server do not receive _SERVER['HTTP_X_REQUESTED_WITH'] ... as a result Elgg do not consider SmartClient request as AJAX call and returns the full HTML rather than json or xml.
I read on net, most of the AJAX frameworks like YUI, JQuery, EXT etc set _SERVER['HTTP_X_REQUESTED_WITH'] to let server know that the call is AJAX call rather than normal HTTP page request call. Does SmartClient also do the same?
Please let me know how to set _SERVER['HTTP_X_REQUESTED_WITH'] in SmartClient or is there some other way to handle this issue.
Regards,
Gaurav