Thanks for your example, just have tried it According to my tests 1) REST API request is successfully processed on OM server (according to logs) without any OM configuration modifications 2) the error you are seeing: "No 'Access-Control-Allow-Origin' header is present on the requested resource" is browser restriction [1]
According to this [2] article, some modification of java code might help Will try it and write back ... [1] https://stackoverflow.com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-header-is-present [2] https://www.codeschool.com/discuss/t/how-to-solve-no-access-control-allow-origin-header-is-present-on-the-requested-resource-origin-null-is-therefore-not-allowed-access-in-angular-js/28989/12 On Tue, Dec 26, 2017 at 1:51 PM, James Chan <[email protected]> wrote: > Dear Maxim, > > What I did is following the example: > > > The openMeetings is installed on a linux server with ip address: > 192.168.128.38 > > $('#div1').click(function () { > $.ajax({ > method: "GET", > url: "http://192.168.128.38:5080/ > openmeetings/services/user/login", > data: {user: 'gaoshusheng', pass: '$Admin123'}, > dataType: "json", > success: function(data){ > alert('success!'); > }, > error:function(jqXHR, textStatus, errorThrown){ > alert('error!'); > } > }); > }); > > After running these line of code on the browser. > > the script jump to: alert('error!’); > > Although from the debug browser reply, we can see the ID is already > replied with status “success”. But because the error, we are unable to > continue with the functions. > > The error shows: > > XMLHttpRequest cannot load http://localhost:5080/ope >> nmeetings/services/user/login?user=gaoshusheng&pass=%24Admin123. No >> 'Access-Control-Allow-Origin' header is present on the requested resource. >> Origin 'http://localhost:9090' is therefore not allowed access. >> > > > Best regards, > James > > > On 26 Dec 2017, at 12:29 PM, Maxim Solodovnik <[email protected]> > wrote: > > I'm afraid I need something I can run and test ... > Maybe you can send the link to example github project? > > On Tue, Dec 26, 2017 at 10:43 AM, James Chan <[email protected]> wrote: > >> Dear Maxim, >> >> >> The error shows: >> >> XMLHttpRequest cannot load http://localhost:5080/openmeet >> ings/services/user/login?user=gaoshusheng&pass=%24Admin123. No >> 'Access-Control-Allow-Origin' header is present on the requested resource. >> Origin 'http://localhost:9090' is therefore not allowed access. >> >> >> Best Regards, >> James >> >> On 26 Dec 2017, at 10:36 AM, Maxim Solodovnik <[email protected]> >> wrote: >> >> Any additional error details? >> >> On Tue, Dec 26, 2017 at 8:38 AM, Yue Chan <[email protected]> wrote: >> >>> Dear Maxim, >>> >>> I have followed your instruction to set the parameters. However, the >>> error still exists. The jQuery call still jump to error. Is there other >>> things that I should do? >>> >>> Thanks and best regards, >>> >>> James. >>> >>> >>> >>> >>> On 23 Dec 2017 6:08 pm, "Maxim Solodovnik" <[email protected]> wrote: >>> >>> I'm here to help ;) >>> >>> WBR, Maxim >>> (from mobile, sorry for the typos) >>> >>> On Sat, Dec 23, 2017, 17:06 James Chan <[email protected]> wrote: >>> >>>> Hi Maxim, >>>> >>>> Thanks for the feedback. >>>> >>>> >>>> Best regards, >>>> >>>> James >>>> >>>> >>>> >>>> On 20 Dec 2017, at 7:01 PM, Maxim Solodovnik <[email protected]> >>>> wrote: >>>> >>>> Hello James, >>>> >>>> Please do not write personal emails (subscribe to user@ list >>>> http://openmeetings.apache.org/mail-lists.html) >>>> >>>> According to your question: you need to go to OM->Admin->Config >>>> and update "header.content.security.policy" configuration: >>>> http://openmeetings.apache.org/GeneralConfiguration.html >>>> >>>> >>>> On Wed, Dec 20, 2017 at 9:11 AM, James Chan <[email protected]> wrote: >>>> >>>>> Dear Maxim, >>>>> >>>>> I am trying to write a simple application, which having the following >>>>> code: >>>>> >>>>> Environment: >>>>> >>>>> openmeetings version 4.0.1 running on linux in another server. >>>>> >>>>> $.ajax({ >>>>> method: "GET", >>>>> url: 'http://192.168.128.38:5080/openmeetings/services/user/login', >>>>> data:{ >>>>> user:’TestAccount', >>>>> pass:’@TestingPass' >>>>> }, >>>>> dataType:'json', >>>>> success:function (data) { >>>>> alert('success'); >>>>> }, >>>>> error:function (d) { >>>>> console.log(d); >>>>> alert(d); >>>>> } >>>>> }); >>>>> >>>>> However, it is having the cross domain error. >>>>> >>>>> Could you please help to give me some pointers as I have been trying >>>>> to search the web but with no luck. >>>>> (Some suggest using allow-access-control-origin = ‘*’, does it mean I >>>>> need to modify the openmeetings code?) >>>>> >>>>> >>>>> >>>>> Thanks >>>>> >>>>> James >>>>> >>>> >>>> >>>> >>>> -- >>>> WBR >>>> Maxim aka solomax >>>> >>>> >>>> >>> >> >> >> -- >> WBR >> Maxim aka solomax >> >> >> > > > -- > WBR > Maxim aka solomax > > > -- WBR Maxim aka solomax
