Yes.  Jsonp is only for get and will not work with put or delete - for those 
you will need the headers.  

Sent from my LG Mobile

[email protected] wrote:

>While I was googling just now, I found out following link
>http://john.sh/blog/2011/6/30/cross-domain-ajax-expressjs-and-access-control-allow-origin.html
>
>It mentioned adding Access Control Allow Origin headers to allow cross 
>domain requests.
>
>What do you think about this approach ?
>
>Is it good one ?
>
>On Friday, February 15, 2013 5:26:03 PM UTC+5:30, greelgorke wrote:
>>
>> yes, yuo can just deliver the html page via node, and get rid of 
>> cross-cite issues this way. but node is often used side by side with more 
>> traditional systems like php, rails or even java webapps, so it's useful to 
>> know how to handle it.
>>
>> so what is exactly your question? i can't tell you much about wamp and 
>> configuration of mod_rewrite, but google is your friend here.
>>
>> jsonp solution is just not affected by same-origin-policy. look here 
>> http://en.wikipedia.org/wiki/JSONP 
>>
>> Am Freitag, 15. Februar 2013 12:21:20 UTC+1 schrieb [email protected]:
>>>
>>> You know it's hard to digest the fact that NodeJS is itself a Web Server, 
>>> so it can contain HTML in it & we don't necessarily need a WAMP server :)
>>>
>>> On Friday, February 15, 2013 3:33:24 PM UTC+5:30, 
>>> [email protected]:
>>>>
>>>> Can you please explain in detail how can I achieve that ?
>>>> I have index.html running on WAMP server & NodeJS is installed in 
>>>> different folder on my machine & also listens to different port.
>>>>
>>>> Here is jQuery code
>>>>
>>>> $(document).ready(function(){
>>>>           $("button").click(function(){
>>>>             $.get("http://localhost:8081",function(data,status){
>>>>                 console.log(data);
>>>>               });
>>>>           });
>>>>         });
>>>>
>>>> On Friday, February 15, 2013 2:39:04 PM UTC+5:30, greelgorke wrote:
>>>>>
>>>>> you can do $.json with jsonp calls. you server then have to return 
>>>>> something like this:
>>>>>
>>>>> response.end(req.query.callback + '('+JSON.stringify(rows) + ');');
>>>>>
>>>>> other approach is to configure a forwarding from localhost:81/api -> 
>>>>> localhost:8081
>>>>>
>>>>> Am Freitag, 15. Februar 2013 09:21:29 UTC+1 schrieb 
>>>>> [email protected]:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have installed NodeJs through windows installer.
>>>>>> I have this following program for connecting to MySql db to return 
>>>>>> records
>>>>>>
>>>>>> ===================================================
>>>>>> // Include http module,
>>>>>> var http = require('http'),
>>>>>> // And mysql module you've just installed.
>>>>>>    mysql = require("mysql");
>>>>>> // Create the connection.
>>>>>> // Data is default to new mysql installation and should be changed 
>>>>>> according to your configuration.
>>>>>> var connection = mysql.createConnection({
>>>>>>    user: "root",
>>>>>>    password: "",
>>>>>>    database: "books"
>>>>>> });
>>>>>> // Create the http server.
>>>>>> http.createServer(function (request, response) {
>>>>>>    // Attach listener on end event.
>>>>>>    request.on('end', function () {
>>>>>>       // Query the database.
>>>>>>       connection.query('SELECT * FROM authors;', function (error, 
>>>>>> rows, fields) {
>>>>>>          response.writeHead(200, {
>>>>>>             'Content-Type': 'x-application/json'
>>>>>>          });
>>>>>>          // Send data as JSON string.
>>>>>>          // Rows variable holds the result of the query.
>>>>>>          response.end(JSON.stringify(rows));
>>>>>>       });
>>>>>>    });
>>>>>> // Listen on the 8080 port.
>>>>>> }).listen(8081);
>>>>>> ===================================================
>>>>>>
>>>>>> As you can see on last line this program will listen to port 8081.
>>>>>> I have WAMP server in which I have created a project and have an 
>>>>>> index.html page in it.
>>>>>> From index.html page I am hitting Node.js program above through $.get 
>>>>>> of jQuery ajax.
>>>>>>
>>>>>> But WAMP is running on port 81, so Chrome is not allowing me to access 
>>>>>> Cross Origin resources.
>>>>>>
>>>>>> What can I do to hit Node JS server mentioned above through the 
>>>>>> index.html page hosted on WAMP server.
>>>>>> (FYI : WAMP is a PHP server)
>>>>>>
>>>>>> Please let me know.
>>>>>>
>>>>>
>
>-- 
>-- 
>Job Board: http://jobs.nodejs.org/
>Posting guidelines: 
>https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>You received this message because you are subscribed to the Google
>Groups "nodejs" group.
>To post to this group, send email to [email protected]
>To unsubscribe from this group, send email to
>[email protected]
>For more options, visit this group at
>http://groups.google.com/group/nodejs?hl=en?hl=en
>
>--- 
>You received this message because you are subscribed to the Google Groups 
>"nodejs" group.
>To unsubscribe from this group and stop receiving emails from it, send an 
>email to [email protected].
>For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to