My code works fine in other browsers than Safari 6.1.2 on Mac OS Lion.
Below is the ajax entry I am using -
$.ajax({ type: 'POST', dataType: 'text/html', url:"/MyProxy.php", data:{"server":"mydomain.com", "user":"vijay", "passd":"highly@secret"}, error: function(data) { console.log(data); alert("Failure - "+data); return; }, success: function(data) { console.log("Success - "+data); parseInformation(data); } });
Also for debugging purposes, I entered the logs into my PHP server code
header('cache-control: no-cache'); function getRealPOST() { $pairs = explode("&", file_get_contents("php://input")); $vars = array(); foreach ($pairs as $pair) { $nv = explode("=", $pair); $name = urldecode($nv[0]); $value = urldecode($nv[1]); $vars[$name] = $value; } return $vars; } echo "-------"; var_dump($_POST); echo "-------"; print_r(getRealPOST());
In Safari, console logs display something like
-------array(2) { ["userName"]=> string(5) "vijay" ["passwd"]=> string(4) "hig" } -------Array ( [ serverAdd] => mydomain.com [userName] => vijay [passwd] => hig )
Any guess why Safari behaves this way, even with the iPad / iPhone and another OS where Safari is used as a browser, I ran into this truncation problem. I also read a post in which people encounter such problems, but in those cases they had a very big request, and on the other hand, just a small request.
Any help?
javascript safari ajax php
Vijaykumar
source share