Suneido

Integrated Application Platform

  • Home
  • Learning
    • Suneido Manual
    • Beginners
      • Inside Suneido
      • The Suneido Programming Language
      • The Suneido Database
      • Installing Suneido
      • Building Suneido
      • IDE Go To Tour
      • Upgrading To A New Release
    • Advanced
      • Canvas Control
      • DrawControl Part 1
      • DrawControl Part 2
      • DrawControl Part 3
      • SAX Like XML Processing
      • A Plug-In Architecture
      • A Simple Wizard Framework
      • An HTML Include Facility
      • An RSS 2 Feed Creator
      • MIME Generation
      • A New Add-on Facility
      • Workspace Improvement Hack
    • Mockito for Suneido
    • The Suneido Task Scheduler
    • Contributing To Suneido
    • Contributor Assignment of Copyright
    • Language Translation
    • Future Directions
    • Interview With Andrew Mckinlay
  • Forum
    • Announcements
    • Internals & Enhancements
    • Cookbook
    • General
  • FAQ
  • Screenshots
  • Downloads
  • Links

Javascript calling Suneido function

Integrated Application Platform › Forums › General › Javascript calling Suneido function

  • This topic has 5 replies, 2 voices, and was last updated 10 years, 6 months ago by amckinlay.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • July 14, 2012 at 7:50 pm #731
    emilevanpassel
    Participant

    I am puzzling to get a Javascript function to call a Suneido function. I have an HTML page with Javascript, the page running in BrowserControl. I can get it to call a Suneido function, but only functions that have no data returning. For example if I want to do a query, how can I make a function return the query result, back to the calling Javascript function?

    July 14, 2012 at 8:18 pm #925
    amckinlay
    Keymaster

    Are you using the suneido:// protocol or running through HttpServer ?

    I think you would make an AJAX call. If you are using HttpServer and may have different browsers then you might want to use something like jQuery.ajax

    If you are using suneido:// then you can do something like suneido://eval?MyFunc()

    If you’re using HttpServer then you would add your function to HttpMap

    Your function can then do a query and return the results as JSON or XML.

    From the javascript side, this is very similar to what you would do in a normal web app with any other back end.

    Is that what you are looking for, or am I misunderstanding?

    July 14, 2012 at 9:31 pm #926
    emilevanpassel
    Participant

    I am using the suneido://eval? protocol, but I can’t get it to assign the result to a variable. The only reference in the documentation I see is an example which shows:

    function openHelp()
    {
    document.location="suneido:/eval?OpenBook('HelpBook', 'PageName')";
    }

    This works for calling functions that do not return any result. But when it returns a result, I can’t assign it to a variable. I tried:

    var x=suneido:/eval?TestingJS();

    but it fails, and when I use:

    var x="suneido:/eval?TestingJS();"

    it only assigns the string, and no call is made. I’m new to most of Javascript, so I probably got the syntax wrong.

    July 14, 2012 at 9:39 pm #927
    amckinlay
    Keymaster

    You need to make an AJAX call. There is lots of help on this on the web.

    e.g. http://www.w3schools.com/xml/xml_http.asp

    Javascript can not call Suneido directly – it can only make requests to web servers, which in this case is Suneido.

    July 21, 2012 at 11:58 am #928
    emilevanpassel
    Participant

    I tried the AJAX solution. It is interesting to see what I can do with that. I was wondering how many users can actually be “connected” like this. But this question is more interesting for the other discussion, the one about replacing the cSuneido client with some other type of interface. Having to use HTML, CSS and Javascript on top of Suneido is a bit much, but the flexible number of “connected” users may be an advantage.

    July 21, 2012 at 5:42 pm #929
    amckinlay
    Keymaster

    I like the idea of using the browser for the user interface. But I agree that it is not so good to have to use HTML, CSS, and JavaScript (as well as Suneido).

    For multiple connections, it is better to use HttpServer and http:// links instead of the suneido:// protocol. And if you want to handle a lot of connections then jSuneido (the Java version) is better because it is multi-threaded and will take advantage of multiple cores and more memory with 64 bit.

    The Eclipse RAP project is interesting – they have implemented SWT on the browser so you can run the same user interface on the desktop or the browser. Google Web Toolkit (GWT) is another interesting approach where they translate Java to JavaScript to run on the browser.

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Log In

Search Forums

Log In
Welcome to the new Suneido Web Site and Forum.
Register
Lost Password
users of the previous PHPBB Forum should be able to log in with their previous username and password.

Recent Topics

  • Alpha copy of gSuneido to play with
  • how to start jsuneido ?
  • Problem Starting Suneido…
  • Dialog not showing buttons
  • New link for Suneidojo

Contact Us | Legal Statement | Privacy Statement | SiteMap

Copyright © 2023 Axon® Development Corporation. All Rights Reserved. - Open Source Integrated Database and Programming Language