-1
{
    "address":"J.P.NAGAR",
    "payment_type": 
    "paymentMethod",
    "time":"2015-09-12 03:22:31",
    "name":"Madhava Raju",
    "tel":"9591865409",
    "userId":"66",
    "deviceId":"66",
    "type":"cod",
    "seats_number":"1",
    "table_id":"2",
    "products[0]":{
        "id":"1397529704",
        "sl":1,"topping":[{"1397879078":"1441207278"}],
        "instruction":"Poora"
    }
}

How can I send the above data to the server using angular ajax with POST method and as URL parameters.

Maxim Shoustin
  • 77,483
  • 27
  • 203
  • 225
Ramesh
  • 1
  • 3
  • value has json object in my case instead of string this is the only problem any suggestions please... – Ramesh Sep 25 '15 at 18:43
  • not sure what you're looking to do here. can you give an example of what you would like that url to look like in your question e.g? www.yourserver.com/apiurl?address=J.P.NaGar&payment_type=paymentMethod... I'm not sure there's a library out there that converts json to query params tbh. but if your needs are simple it's probably to too hard to roll your own – TygerKrash Sep 25 '15 at 18:48

1 Answers1

0

The following sends a POST request:

$http.post(url, data, options).then(onSuccess, onError);
  • url beigin the remote server url, you can also put parameters here, like so ?address=J.P.NAGAR&payment_type=paymentMethod, etc...
  • data being the object you wish to send via POST, I assume you want to POST the object you specified in your post, so put it here.
  • options are optional, you can leave it out if you want. It can be used for timeout and similar.
  • onSuccess and onError are callbacks (functions) to handle the reponse from the server.
erikvimz
  • 5,256
  • 6
  • 44
  • 60