Have your PHP script return an XML document:
PHP:
/*
FunctionResult
FunctionStatus success=1 message=Request processed /
/FunctionResult
*/
$document = DOMImplementation::createDocument();
$document-formatOutput = true;
Very simple!
Please use JSON to return JSON string!
With JSON, we can return value easier than XML!
With XML, you must echo correct tag=))
2009/1/31 GreatBigBore robfbis...@mac.com:
Have your PHP script return an XML document:
PHP:
/*
FunctionResult
Have your PHP script return an XML document, and then parse that XML
with JQuery:
PHP:
/*
FunctionResult
FunctionStatus success=1 message=Request processed /
/FunctionResult
*/
$document = DOMImplementation::createDocument();
That XML is a lot of unnecessary work. If you're running with PHP5,
simply print on success:
echo json_encode(array('success' = true, message = ''));
or on failure:
echo json_encode(array('success' = false, message = ''));
And for the jQuery bit:
$.post('somurl.php', function (data){
if
I prefer this JSON method also.
Just remember to define the dataType as JSON! I've made mistakes many
time of forgetting that and keep wondering why my JSON objects are
always undefined.
On Jan 30, 10:01 am, Eric Garside gars...@gmail.com wrote:
That XML is a lot of unnecessary work. If you're
5 matches
Mail list logo