How do you update the contact information of someone in CiviCRM?
EDIT: I figured out what went wrong. The gender_id change must be specified as a parameter in the .create() function. It shouldn't be changed in the callback. 

The correct code is: 

crmAPI.create('contact', {id:'12966', gender_id:'2'},
   function (result) {
       console.log(result); 
       val=result.values[0]; 
       console.log('UPDATED CONTACT: '+ val.display_name + " " + val.gender_id + " " + val.country_id);
});