Ürfet Demirtaş
Bozkırın yağız programcısı...

ANASAYFA | HAKKIMDA | ASP.NET WEB FORM | C# | BİLGİ GÜVENLİĞİ | LINQ | T-SQL | ASP.NET MVC | GENEL | İLETİŞİM
 
 

asp net ajax jquery json

DEFAULT.ASPX

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html> 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <script src="jquery.js"></script> 

    <script type="text/javascript">

        function Goster(userid) {

            jQuery.ajax({

                url: 'Default.aspx/GetData',

                type: "POST",

                data: "{'userid':" + userid + "}",

                contentType: "application/json; charset=utf-8",

                dataType: "json",

                success: function (data)
                {

                    $("#load").hide();

                    $("#sonuc").fadeOut("slow", function () {

                        $(this).html(data.d)

                    }).fadeIn("slow");
                }
            });
        }

    </script>

</head>

<body>

    <form id="form1" runat="server">
        <div id="load">
            <a href="#" onclick="Goster(1);" >HAYDİ ÇALIŞ</a>
        </div>

        <div id="sonuc">
        </div>

    </form>

</body>
</html>

DEFAULT.ASPX.CS
 

    [WebMethod()]
    public static string GetData(int userid)
    {
        return "BURAYA HERŞEY GELEBİLİR <B> <TR> <TD> VS. " + userid.ToString();
    } 

 


Şairin de dediği gibi; 'programcı' adama hazır blog yakışmazdı.

Ürfet Demirtaş (2010) C#.Net