I've been trying out lots of tutorials and SO question to find a way to make the below code work in obj-c. Its a json response from the server, but nothing i've tried works. How should I make the below code in obj-c?
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$.ajax({
url: "http://myjsonurl.com",
data: { employerID: "1", startDate: "2013-09-13", endDate: "2013-09-15" },
success: function(data) { console.log(data); }
});
</script>
</head>
</html>
Change this response page to be purely JSON like so,
{ "employerID": 1, "startDate": "2013-09-13", "endDate": "2013-09-15" }
Make sure to put quotes around those keys unless they are variables.
You can use a third-party tool (linked to one below) to call this url and get the response as data, then convert the data to a NSJSONSerialization object in the completion block.
这不仅是json响应HTML脚本也来了,通知您的Web服务人员清除HTML脚本作为数组,字典格式的结果
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.