0

How do I write a JSON object with a parameter?

Thanks

3
  • could you provide more detail? Commented Apr 17, 2011 at 21:17
  • Not really. I need to POST a JSON object to a Sinatra server as a param. However, I don't know how to create it in order to be read in sinatra as [:param]. thansk Commented Apr 17, 2011 at 21:22
  • I think you have to put it in the headers of the HTTP.request. Go read up on the HTTP specification. Commented Apr 17, 2011 at 22:05

1 Answer 1

1

If this isn't answering your question, you might want to clarify the question.

If you need to POST a JSON object to a server, you're best off using a library like jQuery. Put your object in data and use the following. (See also http://api.jquery.com/jQuery.post/)

$.ajax({
  type: 'POST',
  url: url,
  data: data,
  success: success
  dataType: dataType
});
Sign up to request clarification or add additional context in comments.

1 Comment

I want to do that using Node.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.