Javascript client
This page has moved to docs.servicestack.net/javascript-client
Of course, you're able to call your ServiceStack webservice from your JavaScript client, too.
We do provide our own JsonServiceClients which mimics the .NET Clients in functionality that we make use of in our Redis Admin UI:
- JsonServiceClient.js - Pure JavaScript client
- JsonServiceClient.closure.js - a Google Closure enabled version of the client allowing compilation and bundling within a Closure project
Although most dynamic languages like JavaScript already include support for HTTP and JSON where in most cases it's easier to just use the libraries already provided. Here are a couple of examples from Backbones Todos and Redis StackOverflow that uses jQuery to talk to back-end ServiceStack JSON services:
Using jQuery:
$.getJSON("http://localhost/Backbone.Todo/todos", function(todos) { alert(todos.length == 1); }); $.post("questions", { UserId: authUser.Id, Title: title, Content: body, Tags: dtoTags }, refresh);
JSV Service Client
In our pursuit to provide the fastest end-to-end communication we've also developed a JsvServiceClient in JavaScript that uses the fast JSV Format:
JSV is marginally faster than safe JSON in modern browsers (marginally slower than Eval) but because of the poor JS and String Performance in IE7/8 it performs over 20x slower than IE's native eval().