alertview create

– (IBAction)F_pass_btn:(id)sender {

    

    alt=[[UIAlertView alloc]initWithTitle:@”Enter email Id you provided at the time of registration” message:@”Your new password will be sent to this email address.” delegate:self cancelButtonTitle:@”Ok” otherButtonTitles:@”Cancel”, nil];

    alt.alertViewStyle = UIAlertViewStylePlainTextInput;

    alertTextField1 = [alt textFieldAtIndex:0];

    alertTextField1.placeholder = @”Email-Id”;

    

    [alt show];

}

– (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

{

    if (buttonIndex == 0) {

        NSLog(@”Ok button clicked…”);

        NSURL *url =[NSURL URLWithString:[NSString stringWithFormat:@”http://url/api/api.php?method=forgotpassword&email=%@”,alertTextField1.text]];

        NSLog(@”%@”,url);

        NSURLRequest *req =[[NSURLRequest alloc]initWithURL:url];

        NSURLResponse *res;

        NSError *err;

        NSData *d2=[NSURLConnection sendSynchronousRequest:req returningResponse:&res error:&err];

        dic_data=[NSJSONSerialization JSONObjectWithData:d2 options:NSJSONReadingAllowFragments error:&err];

        NSLog(@”%@”,dic_data);

        NSString *success=[NSString stringWithFormat:@”%@”,[dic_data objectForKey:@”status”]];

        NSLog(@”%@”,success);

        if ([success isEqualToString:@”Success”])

        {

                        UIAlertView *alert1=[[UIAlertView alloc]initWithTitle:nil message:@”Your new password has been mailed to you.” delegate:nil cancelButtonTitle:@”OK” otherButtonTitles:nil, nil];

            [alert1 show];

            

        }

    }

    else

    {

        

        NSLog(@”Cancel button clicked…”);

        [alt dismissWithClickedButtonIndex:1 animated:YES];

        

    }

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s