Firstly, talk to your colleague or check the documents of the URL, to confirm what format of parameters the API needs, and the Request method, such as GET or POST.
Secondly, concatenate the params to the proper format, and don't forget escape the parameters.
If your URL need parameters as normal, try these:
NSDictionary *params = @{@"schoolid" : @"",
@"token" : @"",
@"mobile" : @""};
NSMutableArray *keyValues = [NSMutableArray array];
for (NSString *key in params) {
[keyValues addObject:[NSString stringWithFormat:@"%@=%@&", key, params[key]]];
}
NSString *paramsString = [keyValues componentsJoinedByString:@"&"];
paramsString = [paramsString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
// Don't add / at last unless the URL has, because / is another path
NSString *baseURL = @"https://24x7tracker.com/School/AppSingleTrack";
// If GET, you can use these two lines, or use below
// NSString *urlString=[NSString stringWithFormat:@"%@?%@", baseURL, paramsString];
// NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
// if POST
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:baseURL]];
request.HTTPMethod = @"POST"; // Default is GET, you can send get request by default,
request.HTTPBody = [paramsString dataUsingEncoding:NSUTF8StringEncoding];
[webView loadRequest:request];
Edit:
According to @Shubhank's guess, if the webview's request via ajax, you should confirm the function of javascript, and try these codes in webview's delegate webViewDidFinishLoad:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"javascriptFunction(%@, %@, %@)", param1, param2, param3]];
}
NSURLRequest, i am usingNSMutableURLRequest, get the response, you need i post the method