[pyar] [django] request y json
Mariano Guerra
mariano en marianoguerra.org
Mar Sep 10 11:00:41 ART 2013
Quoting Daniel (2013-09-10 15:31:35)
> 6%5Bidppp%5D=6&6%5Breferencia%5D=false&6%5Bidmoneda%5D=1&6%5Bprecio%5D=
> 32&392%5Bidppp%5D=392&392%5Breferencia%5D=true&392%5Bidmoneda%5D=1&
> 392%5Bprecio%5D=9.99
>
>
> Eso no es JSON ni de cerca. Fijate el código del que esta mandando el
> pedido y decile que por favor, en serio mande JSON
>
>
> es este:
> $.ajax({
> url: "/administracion/guardarmodificaciones/",
> type: "POST",
> dataType: "json",
> data: datos,
> })
>
> y datos es el string que pasé como ejemplo
de la doc de jquery:
dataType (default: Intelligent Guess (xml, json, script, or html))
Type: String
The type of data that you're expecting back from the server.
...
The data option can contain either a query string of the form
key1=value1&key2=value2, or an object of the form {key1: 'value1', key2:
'value2'}. If the latter form is used, the data is converted into a query
string using jQuery.param() before it is sent. This processing can be
circumvented by setting processData to false. The processing might be
undesirable if you wish to send an XML object to the server; in this case,
change the contentType option from application/x-www-form-urlencoded to a more
appropriate MIME type.
de memoria:
$.ajax({url: url, type: "POST", contentType: "application/json", data: JSON.stringify(datos), dataType: "json"})
More information about the pyar
mailing list