Note that there are some explanatory texts on larger screens.

plurals
  1. POPost Request Response in Objective-C
    primarykey
    data
    text
    <p>I am trying to make a post request similar to this</p> <pre><code> $.ajax({ url: "ValidationHandler.ashx", type: "POST", //data: "connectionid=" + connID +"&amp;vp=" + vp, data: "connectionid=" + connID + "&amp;vp=" + vp, dataType: "json", async: false, error: function (XMLHttpRequest, textStatus, errorThrown) { value = '00000' }, success: function (response) { try { if ((response) || (response != 'object')) { //if repsonse is NOT an object - make it an object!!!! value = response.auth } else { value = response.auth; } } catch (ex) { value = response.auth; } } }); return value; </code></pre> <p>I currently have this in my objective-c </p> <pre><code>NSString *url = @"http://ec2-176-34-72-223.eu-west-1.compute.amazonaws.com/Ext/RemoteLogin"; l NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]]; [request setHTTPMethod:@"POST"]; [request setValue:@"email@biztweet.com" forHTTPHeaderField:@"email"]; [request setValue:@"password123" forHTTPHeaderField:@"password"]; NSLog(@"%@", request); NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; [connection start]; if(connection) { myData = [NSMutableData data]; } } -(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *str = [[NSString alloc] initWithData:myData encoding:NSUTF8StringEncoding]; NSLog(@"3: %@", str); } -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { NSLog(@"1: %@", error.description); } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [myData setLength:0]; NSLog(@"2: %@", response.description); } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [myData appendData:data]; } </code></pre> <p>Now when I use this I am getting html code back as the response but I want to get the response written by the c# code. </p> <pre><code>context.Response.Write(GenerateConnectionAuthorisationString(connectionid)); </code></pre> <p>I want to get a string as my response. The javascript is able to get the string response. So where am I going wrong?? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload