Advertisement
Guest User

Ben Shelock

a guest
Jan 4th, 2010
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function doRequest(url) {
  2.                 xmlhttp = new XMLHttpRequest();
  3.                 xmlhttp.open("POST", url, true);
  4.                 xmlhttp.onreadystatechange = function() {
  5.                     if (xmlhttp.readyState == 4) {
  6.                         alert(xmlhttp.responseText)
  7.                     }
  8.                 }
  9.                 xmlhttp.send(null);            
  10.             }
  11.            
  12.             $(document).ready(function(){
  13.                 $('#new').click(function(){
  14.                     var snippet  = $('textarea').val();
  15.                     var gists    = 'http://gist.github.com/gists';                 
  16.                     var url = gists+'?file_ext[gistfile1]=php&file_name[gistfile1]=aFile&file_contents[gistfile1]='+snippet+'&user=theimben&token=ce2f109e83777d2bdbbcccd2d28349b5';
  17.                     doRequest(url);
  18.                 });
  19.             });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement