hi i am doing a project now i going to use ajax to retrieve coordinate from the json in html and pin the coordinate onto a point on the map using javascript but the problem is i am only able to use one point on the map can tell me what to add in ? or how should i change it with? p.s it will be nice if u can change the code from the below and show me how -
function addSymbol() {
-
if (omap.map.getLayer("symbolLayer") == null) {
-
omap.map.addLayer(gLayer);
-
omap.map.infoWindow.resize(760, 425);
-
}
-
gLayer.clear();
-
function ajaxRequest(){
-
var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]
-
if (window.ActiveXObject){
-
for (var i=0; i<activexmodes.length; i++){
-
try{
-
return new ActiveXObject(activexmodes[i])
-
}catch(e){ }
-
}
-
}
-
else if (window.XMLHttpRequest)
-
return new XMLHttpRequest()
-
else
-
return false
-
}
-
-
var mygetrequest=new ajaxRequest()
-
mygetrequest.onreadystatechange=function(){
-
if (mygetrequest.readyState==4){
-
if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1){
-
var books=eval("("+mygetrequest.responseText+")") //retrieve result as an JavaScript object
-
var rssentries=books.places
-
var output = ""
-
var xCoo = ""
-
var yCoo= ""
-
for (var i=0; i<rssentries.length; i++){
-
output += rssentries[i].name
-
xCoo += rssentries[i].x_coordinate
-
yCoo += rssentries[i].y_coordinate
-
}
-
document.getElementById("result").innerHTML = output
-
var stX = xCoo
-
var stY = yCoo
-
var pt = new esri.geometry.Point(stX, stY, omap.map.spatialReference);
-
var attr = { "PlaceName": " Singapore", "PlaceAddr": "addr" };
-
var strImage = "http://www.rw-designer.com/i/download48b.png";
-
var symbol = new esri.symbol.PictureMarkerSymbol(strImage, 25, 25);
-
var infoTemplate = new esri.InfoTemplate();
-
infoTemplate.setContent();
-
var graphic = new esri.Graphic(pt, symbol, attr, infoTemplate);
-
gLayer.add(graphic);
-
}
-
else{
-
alert("An error has occured making the request")
-
}
-
}
-
}
-
mygetrequest.open("GET", "HTMLPage3.htm", true)
-
mygetrequest.send(null);
-
}
-
dojo.addOnLoad(addSymbol);
-
-
this is htmlpage3 -
{ "places": [
-
{
-
"id": "1",
-
"name": "Chinese Swimming Club",
-
"x_coordinate": "35484.66533355533",
-
"y_coordinate": "31293.823929446196",
-
"icon": "C:/Users/L33508/Desktop/Peranakan@SG/Peranakan@SG/images/museum.png"
-
},
-
{
-
"id": "2",
-
"name": "Joo Chiat Police Station",
-
"x_coordinate": "35951.524906914485",
-
"y_coordinate": "31862.739419191174",
-
"icon": "C:/Users/L33508/Desktop/Peranakan@SG/Peranakan@SG/images/museum.png"
-
},
-
{
-
"id": "3",
-
"name": "Saint Patrick Secondary School",
-
"x_coordinate": "55555.5555",
-
"y_coordinate": "55555.5555",
-
"icon": "C:/Users/L33508/Desktop/Peranakan@SG/Peranakan@SG/images/museum.png"
-
},
-
{
-
"id": "4",
-
"name": "Red House",
-
"x_coordinate": "66666.6666",
-
"y_coordinate": "66666.6666",
-
"icon": "C:/Users/L33508/Desktop/Peranakan@SG/Peranakan@SG/images/museum.png"
-
},
-
{
-
"id": "5",
-
"name": "Amber Road Sea View",
-
"x_coordinate": "35580.593252799175",
-
"y_coordinate": "31579.825950310897",
-
"icon": "C:/Users/L33508/Desktop/Peranakan@SG/Peranakan@SG/images/museum.png"
-
}
-
]
-
}
-
-
0 1028 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Yarco |
last post by:
I want to use "Ajax" to create my web for hobby.
But i don't know whether "Ajax" is mature...
And what about with php? Someone have experience on it?
....
|
by: bobzimuta |
last post by:
I'm creating a simple AJAX library. It's an object that will return an
array containing the response text or xml. I'm trying to find a way to
assign the response as a property of the object, but...
|
by: Bugsy |
last post by:
hi fellows pro,,,,,
i want some details regarding AJAX. can anyone help me in that ....
reply me with some good articles as well as tutorials in (.net)
|
by: javainfo |
last post by:
How can i refresh IFRAME and load data through AJAX?
|
by: Thirsty Traveler |
last post by:
Peter Bromberg has an interesting article eggheadcafe discussing AJAX
libraries. He prefers ANTHEM.NET over AJAX.NET because it doesn't break the
stateful page model. Our developers are currently...
|
by: darrel |
last post by:
I've been playing with prototype.js and scriptaculous to create some nice
drag-and-drop interaction on my applications GUI. That's working well.
Now I want to take the next step and start passing...
|
by: matt.delvecchio |
last post by:
hello,
im working on my first production AJAX project, and im noticing
something weird.
when my clientside events fire (user clicks on various product rows), i
make an xmlhttp call. in this...
|
by: Tony |
last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET
distribution - I'm pretty concerned about this. Does anyone know if this
is the same "prototype.js" that is not well-liked...
|
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= |
last post by:
controlsPlease could some of you here post some of your live examples of AJAX
(esp drag panels, collapsable panels, and popup menu.)
(It's one thing to talk about how great something is, but it's...
|
by: Nuno |
last post by:
Hi,
Maybe this question alreay was asked, but now, i'm asking today...
today each ajax framework is the best one to start (open source of
course).
I already see so much (ASP.NET AJAX, GWT,...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |