简体   繁体   English

从另一个Web应用程序调用Web应用程序

[英]Call web application from another web application

I need to call a react web application to another javascript web application, I cannot use the iframe or the object, I cannot use the server require, and I don't know the frontend technologies that I will found, then I must use the basically technologies of every application ( javascript or jquery ). 我需要将React Web应用程序调用到另一个Javascript Web应用程序,我不能使用iframe或对象,我不能使用服务器要求,而且我不知道会发现的前端技术,那么我必须使用每个应用程序(javascript或jquery)的技术。 I tried some ways to do it, for example in javascript 我尝试了一些方法来做到这一点,例如在javascript中

qr=new XMLHttpRequest();
qr.open('get',
    https://www.mywebapp.com/

    ,true);
qr.send('c1=v1&c2=v2');
qr.onload=function(){test2.innerHTML=qr.responseText}

and in jquery 并在jQuery中

var link = "https://mywebapp.com";
    var params = "c1=v1&c2=v2"
    $("#test").load(
        link,
        params,
        function(){alert("ciao")}
    );
});

also in jquery I have tried to use ajax , ajaxSetup+ajax and other way, in every way i tried to change the value of every parameter like traditional true and false or content-type:'text/html' or every parameter i have found the result of every tried was that I was loaded the page, but the page cannot find the static resources ( javascript, css, images ), I need help 在jQuery中我也尝试使用ajaxajaxSetup+ajax和其他方式,以各种方式尝试更改每个参数的值,例如traditional true and falsecontent-type:'text/html'或我发现的每个参数每次尝试的结果是我已加载页面,但是页面无法找到静态资源(javascript,css,images),我需要帮助

Thank you 谢谢

Wow, after some clarification it sounds like the chatbot you have written needs to be embedded in to a page in another application. 哇,经过一番澄清,听起来您编写的聊天机器人需要嵌入到另一个应用程序的页面中。 This way the chatbot doesn't know anything about the page it's being embedded on and the embedding page only needs a little bit of script to kick-start the loading of the chatbot. 这样,聊天机器人对其嵌入的页面一无所知,并且嵌入页面只需要一点脚本就可以启动聊天机器人的加载。

You'll need to make sure you have JavaScript and CSS that can be downloaded from the chatbot server and dropped in to any page, regardless of which frameworks are in use. 无论使用哪种框架,都需要确保您具有可以从chatbot服务器下载并放到任何页面的JavaScript和CSS。

Your JavaScript is then free to grab any other resources (HTML fragment/JavaScript/CSS/Images/etc.) as needed from the chatbot host. 然后,您的JavaScript可以根据需要从聊天机器人主机中获取其他资源(HTML片段/ JavaScript / CSS / Images / etc。)。 This is similar to how you would go about embedding Disqus or Google Maps on to a page. 这类似于将DisqusGoogle Maps嵌入页面上的方式。

I think helping implementing this is way out of scope for a single StackOverflow question but hopefully this will give you some idea of what is required and puts you on the right track. 我认为,帮助实现这一点超出了单个StackOverflow问题的范围,但是希望这可以使您对所需内容有所了解,并使您走上正确的道路。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM