Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var url : String = "http://demo.revivalx.com/todolist-api/get_all_tasks.php"
- var request : NSMutableURLRequest = NSMutableURLRequest()
- request.URL = NSURL(string: url)
- request.HTTPMethod = "GET"
- NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue(), completionHandler:{ (response:NSURLResponse!, data: NSData!, error: NSError!) -> Void in
- var error: AutoreleasingUnsafeMutablePointer<NSError?> = nil
- let jsonResult: NSDictionary! = NSJSONSerialization.JSONObjectWithData(data, options:NSJSONReadingOptions.MutableContainers, error: error) as? NSDictionary
- if (jsonResult != nil) {
- //handling JSON data here
- } else {
- // couldn't load JSON, look at error
- }
- })
- {
- "tasks": [{
- "taskId": "27",
- "name": "testy",
- "description": "ggg",
- "dateCreated": "2014-12-03 17:01:00",
- "dateUpdated": "2014-12-03 17:01:00"
- }, {
- "taskId": "28",
- "name": "asd",
- "description": "asda",
- "dateCreated": "2014-12-04 12:21:54",
- "dateUpdated": "2014-12-09 10:39:26"
- }, {
- "taskId": "29",
- "name": "asd",
- "description": "asd",
- "dateCreated": "2014-12-04 12:21:58",
- "dateUpdated": "2014-12-09 10:39:47"
- }],
- "success": 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement