Data transaction study

比如:interface 接近方法为:

http://211.108.61.165/service/CallExecute?servlet_name=SelectPMemberLogin&data={"MEMBER_ID" : "test", "MEMBER_PWD" : "pwd1234"}

1.get server url as string

2.change to url

3.the context of the data。

4.make an  object and judge the result ,if it is the result we want。===========================================================================================

1.check overlap。

-(IBAction) checkOverlap:(UIButton *)btn

{

  if([txt_id.text isEqualToString:@""])

  {

    alert:input ...

  }else{

    NSString *urlstr = [[WEBSERVICE_URL stringByAppendingString:[NSString stringWithFormat:@"SelectPMemberChk&data = {\"MEMBER_ID\":\%@\}",txt_id.text]] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

    NSLog(@"%@",urlstr);

    NSString *jsonResponse = [NSString stringWithContentsOfURL:url];

    NSLog(@"%@",jsonResponse);

 

    NSDictionary *dict = [jsonResponse JSONValue];

    //ID field 的范围(4-12)这样的限制先check,code省略

    //RESULT 值是根据服务器需要。。。

    if([[dict objectForKey:@"RESULT"] isEqualToString:@"0"])

    {

      alert:ok

    }else

    {

      alert:this id is already exist.

    }

  }

  isCheckOverlap=TRUE;//最后提交的时候,得判断有没有checked overlap。。。

}

 

posted @ 2011-10-24 19:17  Oakshil  阅读(114)  评论(0编辑  收藏  举报