title: How to use jsonp with node.js express
body: <p>i'm trying to make Samsung Smart TV app with node.js .</p>
  
  <p>In my project, i want to make my app communicating with server pc.</p>
  
  <p>According to Many Web sites, i can do this with "jsonp".</p>
  
  <p>Here is a client side code that i found.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;jsonp test&lt;/title&gt;
      &lt;script src="http://code.jquery.com/jquery-1.6.2.min.js"&gt;&lt;/script&gt;      
      &lt;script type="text/javascript"&gt;
          $(function(){               
              $('#select_link').click(function(e){
                  e.preventDefault();
                  console.log('select_link clicked');
  
                  function test(data){
                      return {"message":"ok"};
                  }
  
                   $.ajax({
                      dataType: 'jsonp',
                      data: "data=yeah",                      
                      jsonp: 'callback',
                      url: 'http://172.20.10.3:3000/endpoint?callback=?',                     
                      success: function(data) {
                          console.log('success');
                          console.log(JSON.stringify(data));
                      }
                  });
              });             
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="select_div"&gt;&lt;a href="#" id="select_link"&gt;Test&lt;/a&gt;&lt;/div&gt;    
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>And, here is a server side code that i found.</p>
  
  <pre><code>app.get('/endpoint', function(req, res){
  var obj = {};
  obj.title = 'title';
  obj.data = 'data';
  
  console.log('params: ' + JSON.stringify(req.params));
  console.log('body: ' + JSON.stringify(req.body));
  console.log('query: ' + JSON.stringify(req.query));
  
  res.header('Content-type','application/json');
  res.header('Charset','utf8');
  res.send(req.query.callback + '('+ JSON.stringify(obj) + ');');
  });
  </code></pre>
  
  <p>These codes are working on my pc(server pc), but when i open client page on others computer, it doesn't work.</p>
  
  <p>Console just give me this log :</p>
  
  <pre><code> X GET http://172.30.2.2:3000/endpoint?callback=jQuery11020685203080996871_1376482492523&amp;data=yeah&amp;_=1376482492524  
  </code></pre>
  
  <p>I want to use jsonp to handle cross-domain, but it doesn't work i think...</p>
  
  <p>What can i do to fix this?</p>
  
  <p>Please give me help!!</p>