#1 mORMot 1 » Server -> Delphi Rest Web Service, Client -> Javascript » 2012-11-25 23:03:28

rdufour
Replies: 1

I've tried the demo Rest web Service server/client written in Delphi. So, Ok, the "Delphi" client can connect to the "Delphi" server. Can someone PLEASE post an example of connecting to the Delphi Rest Web Service (server) using "Javascript"?

I am simply trying to execute the example "Sum" function that is found in the demo server.

This is what I have (my server listens on port 8089): All I get is a Error: Timeout: Undefined.

<JAVASCRIPT>
      var dataObj = {};
      dataObj['A'] = '1';
      dataObj['B'] = '2';

      $.ajax({
        url: 'http://localhost:8089/Sum',
        type: 'GET',
        data: dataObj,
        contenttype: 'application/json; charset=utf-8',
        dataType: 'jsonp',
        timeout: 10000,
        success: function(data, textStatus, jqXHR){
            alert(textStatus);
          $('#the_result').val( data.name );
        },
        error: function(jqXHR, textStatus, errorThrown){
            alert('Error:'+textStatus+': '+errorThrown+'\n'+jqXHR.responseText );
        },
        jsonpCallback: 'JsonpCallback'
      });
    }
</JAVASCRIPT>

A lot of posts mention how easy it is to use morMot, however, I've been spinning my wheels for days, "Googled" half a million pages, and cannot seem to find the answer.

Any help would be very much appreciated.

Richard

Board footer

Powered by FluxBB