简体   繁体   中英

Passing variables from server-side javascript to client-side javascript

OK. I spent all day on this problem with no solution. I've got a client-side html page that I am wanting to embed another server-side html page into that would contain a jQuery autocomplete input textbox. The reason I want to do this is so the ajax in the autocomplete can directly access a php file also sitting on the server and not use jsonP requests. To do this is not a problem.

Problem: Once the user has selected a value from the autocomplete, I need to send that value (out of the server-side js in embedded browser) back to the client-side js (in the main browser js) for further processing. I'm using an embedded OLE Microsoft web browser inside the main browser app. (I know this is not ideal, but we're using a third party plugin that uses ActiveX). I thought of maybe changing a property of the embedded browser control such as status text, assigning it the value and recognizing that event in the main browser, but the browser control doesn't allow changing of properties (besides width and height) via js.

I'm completely open to ideas that take a different route if there are no solutions to this one.

Thanks in advance.

不知道我是否清楚地了解您的要求,但是window.postMessage是否有帮助?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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