第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

jQuery ajax 在 Sharepoint 可視 Web 部件中不起作用

jQuery ajax 在 Sharepoint 可視 Web 部件中不起作用

C#
慕田峪9158850 2021-08-22 18:11:29
所以我試圖在我的 Sharepoint 2013 Visual WebPart 中做 jQuery ajax 的基本示例:<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script><script type = "text/javascript">function ShowCurrentTime() {    $.ajax({        type: "POST",        url: "SPtest.aspx/GetCurrentTime",        data: '{name: "' + $("#<%=txtUserName.ClientID%>")[0].value + '" }',        contentType: "application/json; charset=utf-8",        dataType: "json",        success: OnSuccess,        failure: function(response) {            alert(response.d);        }    });}function OnSuccess(response) {    alert(response.d);}</script><div>Your Name :<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox><input id="btnGetTime" type="button" value="Show Current Time"    onclick = "ShowCurrentTime()" /></div>并在 VisualWebPart1UserControl.ascx.cs 中的服務(wù)器上[System.Web.Services.WebMethod]public static string GetCurrentTime(string name){    return "Hello " + name + Environment.NewLine + "The Current Time is: "        + DateTime.Now.ToString();}它不起作用,如果在 chrome 中打開調(diào)試器,我可以看到它在服務(wù)器端拋出這個(gè)錯(cuò)誤 500:Server Error in '/' Application.Unknown web method GetCurrentTime.Parameter name: methodNameDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: Unknown web method GetCurrentTime.Parameter name: methodNameSource Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.Stack Trace: 我不知道出了什么問題。
查看完整描述

1 回答

?
慕村9548890

TA貢獻(xiàn)1884條經(jīng)驗(yàn) 獲得超4個(gè)贊

問題已在此處得到解答。

You cant add a WebMethod to a webpart. A webpart is a server control and outputs html to the page.



查看完整回答
反對(duì) 回復(fù) 2021-08-22
  • 1 回答
  • 0 關(guān)注
  • 207 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)