Question: How to implement checkbox in tableview section header. my code is, 

```
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *tempView=[[UIView alloc]initWithFrame:CGRectMake(0,200,300,244)];
    tempView.backgroundColor=[UIColor clearColor];

     UIButton *leftSecCheckBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [leftSecCheckBtn setBackgroundImage:[UIImage imageNamed:@"checkbox_empty.png"] forState:UIControlStateNormal];
    [leftSecCheckBtn setBackgroundImage:[UIImage imageNamed:@"checkmark_Tick.png"] forState:UIControlStateSelected];
    [leftSecCheckBtn setFrame:CGRectMake(22,-2, 26, 26)];
    [leftSecCheckBtn addTarget:self
               action:@selector(leftSectionCheckBox:)
     forControlEvents:UIControlEventTouchUpInside];
    [tempView addSubview:leftSecCheckBtn];

}

-(void)leftSectionCheckBox:(id)sender
{   
    UIButton *selectedButton = (UIButton *) sender;
    {
        if([selectedButton isSelected ]==YES)
        {
            [selectedButton setSelected:NO];
        }
        else
        {
            [selectedButton setSelected:YES];
        }
    }
}

```

Added button in ViewForHeader function,But, the button's image is not changing,??

Answer: 
```
   $.ajax({
        url: 'http://gdata.youtube.com/feeds/api/videos/' + code,
        type: 'get',
        dataType: 'json',
        success: function(data) { 
           console.log('Result 1: ');
           console.log(data.responseText);
            alert(x);
//          ^^^^^^^^when get any success then use alert on ajax success
        },
        error: function(e) {
            var text = e.responseText;

            parser = new DOMParser();
            xmlDoc = parser.parseFromString(text, "text/xml");

            var titleXml = xmlDoc.getElementsByTagName('title')[0];
            var contentXml = xmlDoc.getElementsByTagName('content')[0];

            title = titleXml.childNodes[0];
            content = contentXml.childNodes[0];

            x = title;
            alert(x); 
//          ^^^^^^^^when get any error then use alert on ajax error  

        }
    });

```
Try this code please :

```
           var x;

$.ajax({
    url: 'http://gdata.youtube.com/feeds/api/videos/' + code,
    type: 'get',
    dataType: 'json',
    success: function(data) { 
       x = 0;
       console.log('Result 1: ');
       console.log(data.responseText);
    },
    error: function(e) {
        var text = e.responseText;

        parser = new DOMParser();
        xmlDoc = parser.parseFromString(text, "text/xml");

        var titleXml = xmlDoc.getElementsByTagName('title')[0];
        var contentXml = xmlDoc.getElementsByTagName('content')[0];

        title = titleXml.childNodes[0];
        content = contentXml.childNodes[0];

        x = title;

    }
});

alert(x);

```

What is your error ?