Hot answers tagged ajax
6
You can use the ECMA Script Client Object Model:
ExecuteOrDelayUntilScriptLoaded(loadWebs, "sp.js");
function loadWebs() {
var clientContext = new SP.ClientContext.get_current();
this.webs = clientContext.get_web().get_webs();
clientContext.load(this.webs);
clientContext.executeQueryAsync(Function.createDelegate(this, ...
4
It's throwing the error because the <asp:ScriptManager> tag is most likely defined in your master page, causing two instances on the page you are trying to load.
http://social.msdn.microsoft.com/Forums/br/sharepoint2010general/thread/54c271ee-de71-4e47-b02b-29a1d540b81c
3
The service needs to be AJAX enabled to generate a javascript proxy for you. Lists.asmx is not AJAX enabled.
[WebServiceBinding(ConformsTo=WsiProfiles.BasicProfile1_1), WebService(Namespace="http://schemas.microsoft.com/sharepoint/soap/")]
public class Lists : GenericService, ISoapServiceLists, ISoapServiceListData, ISoapServiceListSchema, ...
3
I would recommend that your teams build all their products against version 3.5 of the .NET framework.
If necessary you can map DLL versions in your web.config file using bindingRedirect to use the newer version of AJAX Extensions. You might need additional SafeControl entries if you have multiple versions.
3
I've done ajax a few different ways.
When deving webparts I usually try to use the ICallbackEventhandler (http://msdn.microsoft.com/en-us/library/system.web.ui.icallbackeventhandler.aspx), especially when creating webparts that need ajax.
I've also had a scenario when I used an update panel ...
3
SharePoint works great with AJAX. Two of the great improvements for SharePoint 2010 was Client Side Object Model and REST interface which makes JavaScript development against SharePoint a lot easier that using the old Web Services.
Another great option which makes a the Web Services usable and provides a lot of great functionality (and good documentation) ...
3
Since it is an intranet, I think worrying this much is a little over the top.
I guess with fiddler around, anyone can modify their ajax response to the server, so I guess I'm not really following you about why an update panel is more secure than another implementation (such as icallbackeventhandler)? Are you counting on the postback security validation ...
3
Have a look at http://blog.jsonpify.com/
or, as suggested on the blog above, have a look at http://developer.yahoo.com/yql/
YQL can be called from client script using JSONP, allowing you to pass a SQL-ish query against an "Open Data Table". An Open Data Table is an abstraction layer similar to a BCS model in SharePoint. An Open Data Table abstracts web ...
2
I just did a test with SPServices where I set a Single line of text column to an empty string (""), which seemed to work just fine. This was with WSS 3.0 (the simplest test case, IMO).
$().SPServices({
operation: "UpdateListItems",
async: false,
debug:true,
listName: "Sales Opportunities",
ID: 5,
valuepairs: [["StateID", ""]],
...
2
I'd suggest you start learning and using the Sharepoint 2010 Client OM (Client Object Model).
You can read more about it here : http://blogs.technet.com/b/speschka/archive/2009/11/01/using-the-sharepoint-2010-client-object-model-part-1.aspx
Also, if you write your asp.net code properly, you shouldn't have issues data being submitted again.
One example of ...
2
finally i figured out and below is the updated code: hope this will help others..
protected override void CreateChildControls()
{
if (!this._error)
{
try
{
base.CreateChildControls();
UpdatePanel updatePanel1 = new UpdatePanel();
...
2
Dare i ask why you wouldn't just use SPServices (created by @sympmarc), an open source jQuery plugin that wraps methods in the OOTB SharePoint Web / WCF Services, making the use of these services in JavaScript as simple as the following example:
$(document).ready(function() {
$().SPServices({
operation: "GetListItems",
async: false,
listName: ...
2
I think the issue is that the options you are adding to the select don't have the same ids as the values in the source list. You're using the Title for both the option text and the value. Assuming that the DropDownChoice is a Lookup column, you need to use the right id for each option to match what would be saved if you weren't running your script.
2
I largely agree with Per on this one. (+1 Per)
Loading JS from another server, especially when using HTTPS for SharePoint causes warnings in IE about loading unsecured/untrusted resources (I can't exactly remember the message). You can load JQuery (for example) from a CDN just fine but this is the problem we had when doing this. Also from memory, I think ...
2
On the security side UpdatePanel and pure AJAX are exactly the same. When posting using AJAX you can also check CurrentUser
The differences between UpdatePanel and pure AJAX are:
Ease of implementing. UpdatePanel is very easy. Pure AJAX requires more work
Performance. UpdatePanel is doing a full page postback, just skipping some rendering parts. Pure AJAX ...
2
It is difficult to point out the exact reason for the issue. Here are som thougts which maybe can help you finding the solution:
I have some posts about httphandlers in sharepoint on my blog, among them an answer on sharepoint.stackexchange: How to access a Web application/Farm level property bag via jQuery/Javascript/ClientContext
Take a look on some ...
2
I was able to add a file with SP.RequestExecutor
<%-- _lcid="1033" _version="15.0.4128" _dal="1" --%>
<%-- _LocalBinding --%>
<%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" ...
1
Solved! Sort of... I never figured out how to get the list items from xData.responseXML. However, simply replacing it with xData.responseText instead was enough to get the code working. Now find("z\\:row") finds all the list items as expected.
Works in both ie,ff and chrome.
I ended up modifying the contents of the each-loop a bit though. Here's the ...
1
I find it very hard to understand your exact criteria for setting the item in the SELECT box. But you should be able to accomplish this with JQuery in a HTML Form webpart. Here is a pseudo-code example.
$(document).ready(function(){
//Criteria to determine the value to select.
...
1
regarding jQuery and $.ajax you might be having the following trouble regardless of your settings on the ajax call.
http://api.jquery.com/jQuery.ajax/
From the documentation:
Additional Notes:
Due to browser security restrictions, most "Ajax"
requests are subject to the same origin policy; the request can not
successfully retrieve data from a ...
1
I've been experiencing the same problem. I have a SharePoint dashboard where all my custom webparts reside (currently 9 webparts). All webparts retrieve their data from web services and while using AJAX with the Timer works well in terms of initial page load, it can take up to 30 seconds for the last webpart in the sequence to get its data which doesn't look ...
1
I'm not really a developer, but I believe the core of the problem is that ASP.NET processes each page request using a single thread (even where there are multiple Web parts). An UpdatePanel is a really a page-postback and AFAIK it can only post one event at a time.
As such, you will most likely need to create and register asynchronous tasks (i.e. using ...
1
..."And while Core Results Web Part supports asynchronous functioning". I believe this is the problem right there. The initial load of CRWP does indeed work when asynchronous is turned on, but refresh or automatic refresh does not. The asynchronous refresh functions send the part into loading mode and never return.
1
Most likely, the problem is that there are two separate webparts in Search Center: Core Results Web Part and Search Paging Web Part. And while Core Results Web Part supports asynchronous functioning, the paging webpart doesn't seem to have any ajax-related properties.
Actually, CoreResultsWebPart is inherited from DataFormWebPart - that's why we've got the ...
1
In order for my animated image to work in IE, I had to set a timeout (using jQuery).
setTimeout("image_id.src = image_id.src", 100);
where image_id is the id of my animated image.
<img id="image_id" src="~/_layouts/styles/animatedImages/activity.gif" alt="" />
1
My approach is typically to display the loading graphic initially, then hide it on the completefunc call of SPServices. You may want to post this on the SPServices forum if you haven't (I didn't check), but there should be some examples floating around in the discussions that show people doing this.
1
I did the same thing today with a separate .ashx file and a .cs file and it works for me.
I got the same error but then noticed I had made a class name mistake.
Here is my code:
*****DemoHandler.cs********
using System;
using System.Web;
using Microsoft.SharePoint;
namespace CustomHTTPModule
{
public class DemoHandler : IHttpHandler
{
...
1
In visual studio, learn to love the SharePoint Tokens that are available. Read more about them here: http://www.andrewconnell.com/blog/archive/2009/12/03/sharepoint-2010-dev-tidbit-use-the-tokens-in-visual.aspx
Only top voted, non community-wiki answers of a minimum length are eligible


