Hi to All,
I have used below code in my application of User Registration to interact with remote database.
-(IBAction)checkFirstName:(UITextField*)textField
{
NSURL *url = [NSURL URLWithString:@"http://mysite.com"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue: firstName.text forKey:@"firstName"];
[request setDelegate:self];
[request didReceiveDataSelector];
[request startAsynchronous];
firstName.rightViewMode = UITextFieldViewModeAlways;
if (receivedData==0)
{
UIImage *image = [UIImage imageNamed:@"close.png"];
[button setImage:image forState:UIControlStateNormal];
firstName.rightView = button;
}
}
'firstName' is the textfield value which i used to take input from user. I used the below method to receive response from database
-(void)request:(ASIHTTPRequest *)request didReceiveData:(NSData *)data
{
receivedData = [request responseData];
[receivedData appendData:data];
receivedString = [[NSString alloc] initWithData:receivedData
encoding:NSUTF8StringEncoding];
}
'receivedData' is the NSData object, declared globally. I have to get the 'responseData' as either 0 or 1, which will be stored in a variable 'receivedData'.
- How to check the value of 'receivedData' object (0 or 1)?.
- checkFirstName: action will be fired on uitextfield Editing DidEnd event.
Can we use responseData==0 ? Please, suggest me with a solution... Waiting for an urgent response..