asp.net-ajax

How to have a javascript callback executed after an update panel postback?

醉酒当歌 提交于 2019-11-26 08:58:42
问题 I\'m using a jQuery tip plugin to show help tips when the user hovers certain elements of the page. I need to register the plugin events after the page is loaded using css selectors. The problem is I\'m using an ASP.NET Update Panel and after the first postback, the tips stop working because the update panel replaces the page content but doesn\'t rebind the javascript events. I need a way to execute a javascript callback after the Update Panel refreshes its content, so I can rebind the

Cross domain ajax request

你。 提交于 2019-11-26 08:56:43
问题 I want to get the html respond page from the cross domain url. for this I am using the ajax request as, $.ajax({ type: \'GET\', url: \"http://wcidevapps.com/salescentral/idisk/0001000383/iDisk\", dataType: \"jsonp\", success: function (response) { $(response).find(\'li a\').each(function () { listHref.push($(this).attr(\'href\')); }); } }); But after requesting it doesn\'t respond with any result back. 回答1: <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script type=

Rebinding events in jQuery after Ajax update (updatepanel)

别说谁变了你拦得住时间么 提交于 2019-11-26 06:56:50
问题 I have several input and option elements on my page, each (well almost) have an event attached to update some text on the page once they change. I use jQuery which is really really cool :) I also use Microsofts Ajax framework, utilizing the UpdatePanel. The reason why I do that is that certain elements are created on the page based on some server-side logic. I don\'t really want to explain why I use the UpdatePanel - even if it could (it can with quite some effort) be rewritten to use only

ASP.NET MVC and Ajax, concurrent requests?

不羁的心 提交于 2019-11-26 06:34:58
问题 AJAX newbie here! At the moment in my ASP.NET MVC web app my AJAX requests appear to be getting batched or queued, im not sure. No requests seem to be getting completed until the previous request has finished. How do I go about getting the requests to return independantly? I dont necessarily want someone to give me the answer but maybe some links to good tutorials or resources which could help. Thanks 回答1: I'm expanding on Lachlan Roche's answer, which is correct. The ASP.NET framework will

Are MicrosoftAjax.js, MicrosoftMvcAjax.js and MicrosoftMvcValidation.js obsolete as of ASP.NET MVC 3?

二次信任 提交于 2019-11-26 06:30:15
问题 Are MicrosoftAjax.js , MicrosoftMvcAjax.js and MicrosoftMvcValidation.js obsolete as of ASP.NET MVC 3? I haven\'t been able to find much info on this on the web, but from what I\'ve read it implies that these files were used in ASP.NET MVC 1-2, and were replaced by jquery.validate.min.js , jquery.unobtrusive-ajax.min.js and jquery.validate.unobtrusive.min.js . Is that correct? Do I still need the Microsoft files? 回答1: Yes, all Microsoft* helpers are obsolete in ASP.NET MVC 3. For me they have

Sys is undefined

喜夏-厌秋 提交于 2019-11-26 06:06:37
问题 I have an ASP.Net/AJAX control kit project that i am working on. 80% of the time there is no problem. The page runs as it should. If you refresh the page it will sometimes show a javascript error \"Sys is undefined\". It doesn\'t happen all the time, but it is reproducible. When it happens, the user has to shut down their browser and reopen the page. This leads me to believe that it could be an IIS setting. Another note. I looked at the page source both when I get the error, and when not.

Serialize Entity Framework objects into JSON

≯℡__Kan透↙ 提交于 2019-11-26 04:38:44
问题 It seems that serializing Entity Framework objects into JSON is not possible using either WCF\'s native DataContractJsonSerializer or ASP.NET\'s native JavaScript serializer. This is due to the reference counting issues both serializers reject. I have also tried Json.NET, which also fails specifically on a Reference Counting issue. Edit: Json.NET can now serialize and deserialize Entity Framework entities. My objects are Entity Framework objects, which are overloaded to perform additional

How can I convince IE to simply display application/json rather than offer to download it?

允我心安 提交于 2019-11-26 00:20:12
问题 While debugging jQuery apps that use AJAX, I often have the need to see the json that is being returned by the service to the browser. So I\'ll drop the URL for the JSON data into the address bar. This is nice with ASPNET because in the event of a coding error, I can see the ASPNET diagostic in the browser: But when the server-side code works correctly and actually returns JSON, IE prompts me to download it, so I can\'t see the response. Can I get IE to NOT do that, in other words, to just

ASP.NET MVC controller actions that return JSON or partial html

血红的双手。 提交于 2019-11-25 23:35:57
问题 I am trying to create controller actions which will return either JSON or partial html depending upon a parameter. What is the best way to get the result returned to an MVC page asynchronously? 回答1: In your action method, return Json(object) to return JSON to your page. public ActionResult SomeActionMethod() { return Json(new {foo="bar", baz="Blech"}); } Then just call the action method using Ajax. You could use one of the helper methods from the ViewPage such as <%= Ajax.ActionLink(

Setting Access-Control-Allow-Origin in ASP.Net MVC - simplest possible method

主宰稳场 提交于 2019-11-25 23:35:47
问题 I have a simple actionmethod, that returns some json. It runs on ajax.example.com. I need to access this from another site someothersite.com. If I try to call it, I get the expected...: Origin http://someothersite.com is not allowed by Access-Control-Allow-Origin. I know of two ways to get around this: JSONP and creating a custom HttpHandler to set the header. Is there no simpler way? Is it not possible for a simple action to either define a list of allowed origins - or simple allow everyone?