Define "not working". That's a bit vague. Also, where are you calling
your function from? Can you confirm that it is being called?

Something like this might work for you:

function PostHTMLContentTOServer() {
        $.ajax({
                url: "MyData.aspx",
                type: "POST",
                data: escape($("MainDiv").html()),
                dataType: "html",
                success: function(returnData) {
                        alert("Success post");
                }
        });
}

On Tue, Jun 16, 2009 at 4:29 AM, San<sandeep.ra...@gmail.com> wrote:
>
> I want to post some HTML (contained in a div on the page) data using
> jQuery using $.ajax() method.
> But it is not working.
>
> --------
> <script language="javascript" type="text/javascript">
>        function PostHTMLContentTOServer() {
>            var pageData = document.getElementById
> ("MainDiv").innerHTML;
>            $.ajax({
>                url: "MyData.aspx",
>                type: "POST",
>                data: pageData,
>                dataType: "html",
>                success: function(returnData) {
>                    alert("Success post");
>                }
>            });
>          }
>  </script>
> ------
>
> Kindly suggest what should I do.
>

Reply via email to