Jquery.ajax没有在visual studio 2010上工作 [英] Jquery.ajax not working on visual studio 2010

查看:105
本文介绍了Jquery.ajax没有在visual studio 2010上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读xmlfile并使用jquery ajax在谷歌地图上绘图.....使用此功能它在视觉工作室2013上运行得很好但是当我搬到Visual Studio 2010时

来自$ .ajax的部分不起作用...我在标题帮助中包含了jquery jquery-1.4.1.js ....



< pre lang =Javascript> function myFunction(){
alert(' 你好');
var fname = document .getElementById(' <%= hidden.ClientID%>')。value;
alert(fname);
var mapOptions =
{
zoom: 13
mapTypeId:google.maps.MapTypeId.ROADMAP
}
var infowindow = new google.maps.InfoWindow();
var map = new google.maps。 Map document .getElementById(' displayMap '),mapOptions);

$ .ajax({
type: GET
url: 位置\\ + fname +
dataType: xml
成功: function (xml){
$(xml).find( 位置)。each( function (){
Loc = $( this )。find( Loc_Name)。text();
Lat = $( this )。find( 纬度)。text();
Long = $( this )。find( 经度)。text();
var loc = new google.maps.LatLng(Lat,Long);

map.setCenter(loc);

var marker = new google.maps.Marker({
位置: new google.maps.LatLng(Lat,Long),
map:map,
title:' 我的工作场所'
图标:' http://google-maps-icons.googlecode.com/files/factory.png'

});


google.maps.event.addListener(marker,' click' function (){

infowindow.setContent(Loc);
infowindow.open(map,marker);

});



});
}

});
}

解决方案

.ajax不起作用...我已经包含了jquery jquery-1.4标题帮助.1.js ....



 功能 myFunction(){
alert(' hello');
var fname = document .getElementById(' <%= hidden.ClientID%>')。value;
alert(fname);
var mapOptions =
{
zoom: 13
mapTypeId:google.maps.MapTypeId.ROADMAP
}
var infowindow = new google.maps.InfoWindow();
var map = new google.maps。 Map document .getElementById(' displayMap '),mapOptions);


.ajax({
type: GET
url: Location \\ + fname +
dataType: xml
成功: function (xml) {


(xml).find( 位置) .each( function (){
Loc =


I was working on reading xmlfile and ploting it on google map using jquery ajax.....using this function it works just fine on visual studio 2013 but when i move to visual studio 2010
the part from $.ajax doesn't work ...i've included jquery jquery-1.4.1.js at the header help....

function myFunction() {
    alert('hello');
    var fname = document.getElementById('<%=hidden.ClientID%>').value;
    alert(fname);
    var mapOptions =
                {
                    zoom: 13,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                }
    var infowindow = new google.maps.InfoWindow();
    var map = new google.maps.Map(document.getElementById('displayMap'), mapOptions);

    $.ajax({
        type: "GET",
        url: "Location\\" + fname + "",
        dataType: "xml",
        success: function (xml) {
            $(xml).find("Location").each(function () {
                Loc = $(this).find("Loc_Name").text();
                Lat = $(this).find("Latitude").text();
                Long = $(this).find("Longitude").text();
                var loc = new google.maps.LatLng(Lat, Long);

                map.setCenter(loc);

                var marker = new google.maps.Marker({
                    position: new google.maps.LatLng(Lat, Long),
                    map: map,
                    title: 'My workplace',
                icon: 'http://google-maps-icons.googlecode.com/files/factory.png'

                });


                google.maps.event.addListener(marker, 'click', function () {

                    infowindow.setContent(Loc);
                    infowindow.open(map, marker);

                });



            });
        }

    });
}

解决方案

.ajax doesn't work ...i've included jquery jquery-1.4.1.js at the header help....

function myFunction() {
    alert('hello');
    var fname = document.getElementById('<%=hidden.ClientID%>').value;
    alert(fname);
    var mapOptions =
                {
                    zoom: 13,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                }
    var infowindow = new google.maps.InfoWindow();
    var map = new google.maps.Map(document.getElementById('displayMap'), mapOptions);


.ajax({ type: "GET", url: "Location\\" + fname + "", dataType: "xml", success: function (xml) {


(xml).find("Location").each(function () { Loc =


这篇关于Jquery.ajax没有在visual studio 2010上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆