1. Roland Smith
  2. PowerBuilder
  3. Friday, 17 March 2017 20:09 PM UTC

I'm thinking about the possibility of calling PB code from a website hosted in IIS.

Is it possible to use the AJAX method to call PB code?

AJAX is based on a browser function that works similar to the PB function GetURL. Javascript code passes input variables in the URL and a server script runs in the background. When the server side script finishes, it passes the output to a Javascript function specified in the initial call. The assumption is that the output is in XML format but technically it could be any format that the Javascript in your web page can understand.

I would likely be doing this in Classic ASP which consists of hand coded HTML & Javascript on the front end and VBScript on the backend.

Chris Pollach Accepted Answer Pending Moderation
  1. Friday, 17 March 2017 20:38 PM UTC
  2. PowerBuilder
  3. # 1

Hi Roland;

   Food for thought ... why not have either an ASP or ASP.Net code call a PB NVUO deployed as a web service instead?

Regards ... Chris

Comment
  1. Roland Smith
  2. Tuesday, 11 April 2017 01:39 AM UTC
I don't know C# or ASP.NET. The web programming I am familiar with is Classic ASP which uses vbscript on the server. I suppose I should attempt to learn it.

  1. Helpful
  1. Roland Smith
  2. Tuesday, 11 April 2017 01:40 AM UTC
 











I did some research and to call .Net from Classic ASP VBScript it has to be a registered COM object.



The Javascript can AJAX call a small VBScript file on the server that calls the COM object function and returns the result to the browser.



Can you create a .Net Assembly from PB that is COM without a bunch of work arounds?









  1. Helpful
  1. Brad Wery
  2. Tuesday, 11 April 2017 01:41 AM UTC
Create the WCF web service in PB. Host it on your server so you can access its end points. In your web page, use jQuery to call out to your webservice. It'll make everything so much easier. jQuery has a method to call web methods using ajax. Here's an example I quickly found:



http://www.c-sharpcorner.com/UploadFile/rohatash/calling-wcf-services-us...



here's the important code:



$.ajax({  

                type: "POST",  

                contentType: "application/json; charset=utf-8",  

                url: 'Service.svc/GetData',  

                success: function (data) {  

                    $($.parseJSON(data.d)).each(function (index, value) {  

                        $("#TableID").append("" + value.Name + "" + value.LastName + "" + value.Email + "");  

                    });  

                },  

                error: function (result) {  

                    alert(result);  

                }  

            });  

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.