This is a migrated thread and some comments may be shown as answers.

How to perform a POST operation instead of gets

4 Answers 144 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
jonathan
Top achievements
Rank 1
jonathan asked on 07 Jan 2012, 11:51 PM
How can I change from GET to POST operation?  For example my autocomplete returns sensitive data (username) so I need to do JSON POST and NOT GET to protect against CSRF attacks.

Thanks
-Jonathan

4 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 09 Jan 2012, 09:39 AM
Hello Jonathan,

You can specify type in the read field of the transport, i.e:
dataSource: {
  transport: {
    read: {
      url: " some url ",
      type: "POST",
      // other options
    }
  }
}


The object defined for read will be used as setting for $.ajax.

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
jonathan
Top achievements
Rank 1
answered on 10 Jan 2012, 09:17 PM
This does not work.  fiddler still shows this request as a get.

Thanks
-Jonathan
0
Nikolay Rusev
Telerik team
answered on 11 Jan 2012, 08:55 AM
Hello Jonathan,

See the following sample. If you inspect the XHR request sent to http://fiddle.jshell.net/echo/json/ you will notice that the request method is POST.



Greetings,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Carl
Top achievements
Rank 1
answered on 08 Mar 2012, 06:35 PM
[Redacted]

Realised Jsonp only supports the GET verb.
Tags
Data Source
Asked by
jonathan
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
jonathan
Top achievements
Rank 1
Carl
Top achievements
Rank 1
Share this question
or