2 Replies Latest reply on Apr 18, 2016 2:50 AM by surabhimishra

    javascript function in soy resourceInlineJs

    surabhimishra

      I want to write following function in soy using resourceInlineJs but it does not seem to work:

      getData: function() {
            var d = $.Deferred();
            $
      .ajax({ type: "GET",
            url
      : "/__services/v1/data/map",
            dataType
      : "text" })
            .
      done(function(data) {
            d.resolve(JSON.parse(data.substring(data.indexOf("{")))); })
            .
      fail(function() { d.reject(); });
             return d.promise(); }

      I have written it as:

      {call jive.shared.soy.resourceInlineJs}{param code} 
      $j
      (document).ready(function{lb}
      var d = $j.Deferred();
      $j
      .ajax({lb} type: "GET",
      url
      : "/__services/v1/data/map",
      dataType
      : "text" {rb})
      .
      done(function(data) {lb}
      d.resolve(JSON.parse(data.substring(data.indexOf("{lb}")))); {rb})
      .
      fail(function() {lb} d.reject(); {rb});
      return d.promise(); {rb});
      {/param}{/call}

      Please help! Thanks