This content has been marked as final.
Show 17 replies
-
15. Re: Re: Re: Issue with running javascript on form - function undefined
Laurent MatheoDec 5, 2014 10:40 AM (in response to Laurent Matheo)
You're lucky I had some files around. Here is the example:
Javascript code:
I don't give you the full code, it'll give you the idea here...
Here the domain is "2008-7604" and disney is "192.168.0.14".
//url proxy jsp var mode_proxy="jsp"; //json,jsonp,jsp (only used for standalone) var url_proxy="http://2008-7604:8080/arsys/proxy_gen.jsp"; //url to "disney" var url_users="http://192.168.0.14/testjson/testjson/get_user.php"; //Building search var myurl=url_users+"?tosearch="; myurl=myurl+"mickey"; if (mode_proxy=="jsp") { //jsp proxy, we send the full url as get parameter $.getJSON(url_proxy, { jurl: myurl }, function(json){ handle_json_answer_list(json) }); } else { //json or jsonp if (mode_proxy=="jsonp") { myurl=myurl+"&callback=?"; } $.getJSON(myurl, { }, function(json){ handle_json_answer_list(json) }); } //function to handle the json for the list function handle_json_answer_list(json) { $.each(json,function(key,value){ //Do stuff }); return; }
Proxy jsp code:
<%@ page import="java.io.*, java.net.*" contentType="text/json; charset=UTF-8" %><% /* * PROXY JSP for JSON (or XML). * used to get tiers from lmame */ //LMA: parameters begin String url_get=""; String param_get=""; //url to the php page url_get="http://192.168.0.14/testjson/testjson/get_tier.php"; //expected parameters from the javascript code //jurl=parameters String my_url=""; //Query sent to this jsp page if (request.getParameter("jurl")!= null) { my_url=request.getParameter("jurl"); } //LMA: param end StringBuffer sbf = new StringBuffer(); //Access the page try { URL url = new URL(my_url); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String inputLine; while ( (inputLine = in.readLine()) != null) sbf.append(inputLine); in.close(); } catch (MalformedURLException e) { } catch (IOException e) { } %><%= sbf.toString() %>
-
16. Re: Issue with running javascript on form - function undefined
Brice Rader Dec 5, 2014 10:45 AM (in response to Laurent Matheo)Great, thank you! I'm going to try out 1 and 2. 3 isn't an option for me unfortunately
-
17. Re: Issue with running javascript on form - function undefined
Laurent MatheoDec 5, 2014 11:00 AM (in response to Brice Rader)
Ok