title: add new item to sharepoint list in javascript
body: <p>I want to add a new item to my sharepoint list using javascript. I used the code straight from MSDN but it doesn't work. I think the problem is whith the siteUrl I declare, because when I set alerts like this:</p>
  
  <pre><code>var siteUrl = 'http://units.mil.intra/sites/DGHR/h/default.aspx';
  
      function createListItem() {
          alert('in function ');
          var clientContext = new SP.ClientContext(siteUrl);
          alert('before oList');
          var oList = clientContext.get_web().get_lists().getByTitle('TestPostModification');
          alert('after oList');   
          var itemCreateInfo = new SP.ListItemCreationInformation();
          this.oListItem = oList.addItem(itemCreateInfo);
  
          oListItem.set_item('Title', 'Item from de Hrnode!');
  
          oListItem.update();
  
          clientContext.load(oListItem);
  
          clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
      }
  
      function onQuerySucceeded() {
  
          alert('Item created: ' + oListItem.get_id());
      }
  
      function onQueryFailed(sender, args) {
  
          alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
      }
  </code></pre>
  
  <p>I get the first alert, but I don't get the <code>alert('before oList');</code> So I think there is a problem whith:</p>
  
  <pre><code>var clientContext = new SP.ClientContext(siteUrl);
  </code></pre>
  
  <p>can someone help me please?</p>
  
  <p>ps: the siteUrl is on our intranet site, so you can't reach it from where you are.</p>