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

Do a post with an Ajax Tooltip

4 Answers 161 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 19 Sep 2014, 06:23 AM
Hi
  I'm expecting the answer 'no' here.

Is it possible to do a POST call with a Kendo Tooltip rather than a GET? I appreciate it's probably an unusual request.

thanks

4 Answers, 1 is accepted

Sort by
0
Anthony
Top achievements
Rank 1
answered on 19 Sep 2014, 07:40 AM
Just to add, the request will still be idempotent but I just anticipate unusual cases where I might have to pass a lot of querystring data
0
Accepted
Alexander Popov
Telerik team
answered on 22 Sep 2014, 11:34 AM
Hi Anthony,

This could be achieved by passing a function to the Tooltip's content option instead of an object containing the url. The function can then be used to make a synchronous POST request, store its response in a variable and return it. For example: 
content: function(e) {
  var result = "";
  $.ajax({
    async: false, //ensure the response is received before exiting the content function
    type: "POST",
    url: ...,
    success: function(r){
        result = r;
    }
  });
  return r;
}

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Anthony
Top achievements
Rank 1
answered on 22 Sep 2014, 11:36 AM
great thanks
0
Marc
Top achievements
Rank 1
answered on 16 Dec 2015, 02:00 PM

As an alternative to using synchronous POST requests, setting the e.options.type property in the requestStart event to POST will also work.

 

$("#grid").kendoTooltip({
    filter: "td:nth-child(5)", //fifth column of the grid
    content: {
        url: ...
    },
    position: "bottom",
    requestStart: function(e) {
        e.options.type = "POST";
        e.options.data = ...;
    }
});

 

Tags
ToolTip
Asked by
Anthony
Top achievements
Rank 1
Answers by
Anthony
Top achievements
Rank 1
Alexander Popov
Telerik team
Marc
Top achievements
Rank 1
Share this question
or