Do a post with an Ajax Tooltip

5 posts, 1 answers
  1. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 19 Sep 2014 Link to this post

    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
  2. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 19 Sep 2014 in reply to Anthony Link to this post

    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
  3. Kendo UI is VS 2017 Ready
  4. Answer
    Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 22 Sep 2014 Link to this post

    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!
     
  5. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 22 Sep 2014 in reply to Alexander Popov Link to this post

    great thanks
  6. Marc
    Marc avatar
    4 posts
    Member since:
    May 2015

    Posted 16 Dec 2015 Link to this post

    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 = ...;
        }
    });

     

Back to Top
Kendo UI is VS 2017 Ready