How about a plain old RPC call?

By on 11/6/2018 2:49 PM ()

RPC call for AJAX-request on client to another server?..

By on 11/7/2018 6:04 AM ()

WebSharper RPC calls are technically also AJAX requests, that WebSharper just sets up automatically. But there is some ways to customize it too.

I have understood "remote server" in your question, as another server than which is serving the web application. (If it is the same, then default RPC behavior is fine).

If all your RPC backend is on another server, you can just set WebSharper.Remoting.EndPoint on the client side entry point to point to that URL.

RPC methods can also be customized on how they are called from JavaScript by creating a class that inherits from Remoting.AjaxRemotingProvider and annotating the RPC. This new class will handle the calls on the client side. See documentation here. The simplest use case for this is to define custom URLs for only some RPCs, by overriding the Endpoint property only.

By on 11/7/2018 6:20 AM ()

Hi, the most straightforward ways is to use the .NET bindings for the JS fetch or jQuery ajax, these are available as WebSharper.JavaScript.JS.Fetch and WebSharper.JQuery.JQuery.Ajax.

Also, WebSharper provides a helper for sending a request to a WebSharper Sitelet server side, where the request URL and body are automatically set by the client. See the documentation for using routers. There are some updates to this since, I will expand the doc: Router.Ajax uses JQuery, while a similar Router.Fetch uses JS fetch. Also Router.AjaxWith and Router.FetchWith allows for extra customization of the request.

By on 11/6/2018 8:35 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper