Click here to Skip to main content
15,439,117 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionweb config asp.net project of sql server Pin
Member 1101590512-Sep-21 19:20
MemberMember 1101590512-Sep-21 19:20 
AnswerRe: web config asp.net project of sql server Pin
Richard MacCutchan12-Sep-21 22:08
mveRichard MacCutchan12-Sep-21 22:08 
AnswerRe: web config asp.net project of sql server Pin
Dave Kreskowiak13-Sep-21 1:18
mveDave Kreskowiak13-Sep-21 1:18 
QuestionGet a Field value for recovery a password Pin
Luis M. Rojas3-Sep-21 5:17
MemberLuis M. Rojas3-Sep-21 5:17 
AnswerRe: Get a Field value for recovery a password Pin
Richard Deeming3-Sep-21 5:34
mveRichard Deeming3-Sep-21 5:34 
GeneralRe: Get a Field value for recovery a password Pin
Luis M. Rojas3-Sep-21 5:55
MemberLuis M. Rojas3-Sep-21 5:55 
GeneralRe: Get a Field value for recovery a password Pin
Richard Deeming3-Sep-21 6:10
mveRichard Deeming3-Sep-21 6:10 
QuestionWebService just will not work :-( Pin
Oliver Freeman1-Sep-21 5:48
MemberOliver Freeman1-Sep-21 5:48 
Hi all. I've tried for days now (quite literally) to get a simple web service to work, however it's like nothing in the $Ajax section is run at all. Can anyone help me with this, please?

There are two methods I've been trying, with an img with an OnClick or a button.

Both alerts work ("This button was clicked") but nothing else..

ASP.NET
<form id="form1" runat="server">
        
<p>Click on this paragraph.</p>
        <div>
            	     <img id="imgMediabtn" src="media/login.gif" onmouseover="this.style.cursor = 'pointer';" />
                   <asp:Button ID="Button4" runat="server" Text="Button" OnClientClick="BindTreeview()"/>    
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        </div>
    </form>


JavaScript
<script>
        $(document).ready(function () {
            $("p").click(function () {
                alert("The paragraph was clicked.");
            });

            $("#imgMediabtn").click(function () {
                alert("The image was clicked.");
                $.ajax({
                    type: "POST",
                    url: "MyWebService1.asmx/HelloWorld",
                    data: '{name: "' + $("#<%=TextBox1.ClientID%>")[0].value + '" }',
                     contentType: "application/json; charset=utf-8",
                      dataType: "json",
                    success:
                        function OnSuccess(response) {
                            alert("Hello");
                        },
                      failure: function (response) {
                          alert("Goodbye");
                    }
               
                  });
            });
        });

       
      
        function BindTreeview() {
            alert("The button was clicked.");
                   $.ajax({
                type: "POST",
                url: "TestWebService.aspx/GetCurrentTime",
                data: '{name: "' + $("#<%=TextBox1.ClientID%>")[0].value + '" }',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success:
                    function OnSuccess(response) {
                        alert(response.d);
                    },
                failure: function (response) {
                    alert(response.d);
                }
            })
        }

          

        }


ASP.NET
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class MyWebService1
    Inherits System.Web.Services.WebService

    <WebMethod()>
    Public Function HelloWorld(ByVal name As String) As String
        Return "Hello " & name & Environment.NewLine & "The Current Time is: " &
            DateTime.Now.ToString()
    End Function

End Class

AnswerRe: WebService just will not work :-( Pin
Richard Deeming1-Sep-21 21:59
mveRichard Deeming1-Sep-21 21:59 
GeneralRe: WebService just will not work :-( Pin
Oliver Freeman2-Sep-21 1:59
MemberOliver Freeman2-Sep-21 1:59 
GeneralRe: WebService just will not work :-( Pin
DerekT-P21-Oct-21 7:37
professionalDerekT-P21-Oct-21 7:37 
QuestionIs it possible to add fore ground and back ground to any app that is down? Pin
samflex31-Aug-21 18:39
Membersamflex31-Aug-21 18:39 
AnswerRe: Is it possible to add fore ground and back ground to any app that is down? Pin
Richard Deeming31-Aug-21 22:01
mveRichard Deeming31-Aug-21 22:01 
GeneralRe: Is it possible to add fore ground and back ground to any app that is down? Pin
samflex1-Sep-21 5:50
Membersamflex1-Sep-21 5:50 
GeneralRe: Is it possible to add fore ground and back ground to any app that is down? Pin
Richard Deeming1-Sep-21 21:47
mveRichard Deeming1-Sep-21 21:47 
GeneralRe: Is it possible to add fore ground and back ground to any app that is down? Pin
samflex2-Sep-21 3:02
Membersamflex2-Sep-21 3:02 
Questionproject code in .net for online banking transaction Pin
Jk 0724-Aug-21 5:12
MemberJk 0724-Aug-21 5:12 
AnswerRe: project code in .net for online banking transaction Pin
Richard MacCutchan24-Aug-21 5:40
mveRichard MacCutchan24-Aug-21 5:40 
GeneralRe: project code in .net for online banking transaction Pin
Member 1534301831-Aug-21 22:04
MemberMember 1534301831-Aug-21 22:04 
QuestionI am having problem creating a script to monitor Rest/API services. Pin
samflex23-Aug-21 8:11
Membersamflex23-Aug-21 8:11 
AnswerRe: I am having problem creating a script to monitor Rest/API services. Pin
Richard Deeming23-Aug-21 21:15
mveRichard Deeming23-Aug-21 21:15 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex24-Aug-21 5:08
Membersamflex24-Aug-21 5:08 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
David Mujica24-Aug-21 6:04
MemberDavid Mujica24-Aug-21 6:04 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex24-Aug-21 6:09
Membersamflex24-Aug-21 6:09 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex25-Aug-21 4:18
Membersamflex25-Aug-21 4:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.