fiddolone
ajax test
HTML
<script src="http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js"></script>
<body>
Please click <a href="#" onclick="aia();">here</a> many times on iPad/Safari.
<div class='target'>
Result:
</div>
</body>
JavaScript
function aia()
{
var data = {
json: $.toJSON({
text: 'some text',
array: [1, 2, 'three'],
object: {
par1: 'another text',
par2: [3, 2, 'one'],
par3: {}
}
}),
delay: Math.round(Math.random()*12)
}
$.ajax({
url:"/echo/json/",
data:data,
type:"POST",
success:function(response)
{
$(".target").append("+");
},
error:function(xhr, ajaxOptions, thrownError)
{
alert("There was an error in the ajax call: ["+xhr.status+"] ["+thrownError+"]");
}
});
}