I have this code snippet(not complete though, ignore the ending script tag) ::
<script type="text/javascript">
function gotoa(){
var h = $.get("http://localhost:8080/2_8_2012/jsp/GetJson.jsp", function(result) {
});
alert(result);
var myVar= h;
var storedata={
identifier:"ID",
label:"name",
items: myVar
};
var store = new dojo.data.ItemFileWriteStore({data: storedata});
The code for GetJson.jsp is ::
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="MyPackage.PopulateTextbox" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<%
String temp1;
PopulateTextbox obj = new PopulateTextbox();
temp1 = obj.method();
%>
<%=temp1 %>
</head>
<body>
</body>
</html>
I have a j query get method . And the URL i am passing in it returns me an Json array string. Output of URL ::
[{"ID":1,"Names":"Shantanu","Email":"shantanu.tomar@gmail.com"},{"ID":2,"Names":"Mayur","Email":"mayur.sharma@gmail.com"},{"ID":3,"Names":"Rohit"},{"ID":4,"Names":"Jasdeep"},{"ID":5,"Names":"Rakesh","Email":"rakesh.shukla@gmail.com"},{"ID":6,"Names":"Divyanshu"},{"ID":8,"Names":"hello"},{"ID":9,"Names":"fine"},{"ID":10,"Names":"shivani"}]
Now i want this output for my Data grid i.e i want that var myVar should get this value and then it will be passed on to dojo.data.ItemFileWriteStore. I am unable to do so . Please help ? Thanks.