Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7748809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:52:43+00:00 2026-06-01T10:52:43+00:00

Whats the best way to do a RPC (Remote Procedure Call) from a webpage

  • 0

Whats the best way to do a RPC (Remote Procedure Call) from a webpage or from JavaScript code? I want to keep it in JavaScript if possible so that I can do live updates to the webpage without having to do anything in PHP in case my server goes down I still want the JavaScript to handle page updates… possibly even sending a request to a python shell script running locally… Is this legal from JavaScript?

I prefer having remote machines handling the requests. I see a lot of talk about how XMLRPC or JSONRPC can do this however, I haven’t seen any good examples. I guess Microsoft suggests using their XMLhttprequest however, I haven’t seen anything that doesn’t use their ActiveX call or require special code for Internet Explorer… I just want some simple way of passing a command to some python/ruby/c++ code from a webpage.

Python Server Code (Waiting for a RPC Request):

import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
def my_awesome_remote_function(str):
    return str + "awesome"
server = SimpleXMLRPCServer(("localhost", 8000))
print "Listening on port 8000..."
server.register_function(is_even, "is_even")
server.serve_forever()

EXAMPLE JavaScript Code:

var client = rpc.server("http://localhost:8000/");
var my_local_variable = client.my_awesome_remote_function(param);

Is there a good JSON/JavaScript example someone can point me to that sends a request to a server and gets some data back from that server?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:52:45+00:00Added an answer on June 1, 2026 at 10:52 am

    Hardly it will work this way: client.my_awesome_remote_function. There’s no magic in js like __call in php. Also remote calls are done in js mostly asynchronously using idea of callback – function which is called after finishing of some task.

    var client = rpc.server("http://localhost:8000/");
    var my_local_variable;
    client.rpc('my_awesome_remote_function', [param], function(result) {
        my_local_variable = result;
    });
    

    You can easily find tutorials about that calls. Just google “ajax tutorials”.
    E.g.: http://www.w3schools.com/ajax/ajax_intro.asp (event though w3schools isn’t the best site and have errors in some details, it is still good for beginners).

    All ajax implementations use both modern both XMLHttpRequest and ActiveX control for older IE.

    It is possible to run those requests synchronously, but is considered very bad from the point of user experience. Also, you’ll need to deal with concept of callbacks anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whats the best way to take data from a datareader and manipulate that data,
Whats the best way to zip up files using C#? Ideally I want to
Whats the best way to extract a bit from an unsigned char .In my
whats the best way to tell if a value in javascript is a single
whats the best way to do a redirect (preferably a redirect to action) from
Whats the best way to get a list of data from a local dev
Whats the best way to save variables like userid that is stored and reachable
Android 2.2, NDK R7 Eclipse. Whats best way to debug C++ code? Thanks.
Whats the best way to create a NSIS Welcome Page that has a Bitmap
Whats the best way to achieve that kinda of 'onmouseover options menu to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.