Answer the question
In order to leave comments, you need to log in
How to send json object to someone else's api?
I have a js request like this:
url : 'example.com/json.php',
jsonp : 'callback',
data : {"json" : DataJson},
type : 'GET',
dataType : "jsonp",
DataJson = "{'senderCityId':'506','receiverCityId':'320'}"
uri = URI("example.com/json.php")
params = {"json" => DataJson}
uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
h = JSON.parse(res.body)
http://example.com/json.php?json={'senderCityId':'506','receiverCityId':'320'}
Answer the question
In order to leave comments, you need to log in
Somehow so . It is necessary to add data to the body of the request, and not to the query.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question