摘要: 让客户端JavaScript直接能够异步调用到服务器端的Web Service,这看起来真的是个不错的主意——理想化的分层Ajax应用程序就应该这样嘛!不过作为被ASP.NET服务器端开发模型“宠坏”了的我们,更加熟悉的方法是直接将方法写在ASP.NET页面中,比如处理页面中的某个服务器端按钮Click事件的代码,就可能这样调用定义在同一张页面代码文件中的方法:protected void Button1_Click(object sender, EventArgs e){ myLabel.Text = this.GetTextForLabel();}public string GetT... 阅读全文
posted @ 2013-11-14 17:08 Curious 阅读(691) 评论(0) 推荐(0) 编辑
摘要: 在$.ajax之前添加代码 jQuery.support.cors = true; //之前没有加这句老是提示no transport,我没去深想。 jQuery.support.cors = true; $.ajax ({ type: "POST", contentType: "application/x-www-form-urlencoded", dataType: "html", url: "http://www.*****.com", //这里是网址 success:function(data){alert 阅读全文
posted @ 2013-11-14 14:37 Curious 阅读(8461) 评论(0) 推荐(1) 编辑