Yes, please define "not working".

The problem most likely lies in what is returned here:
var pageData = document.getElementById("MainDiv").innerHTML;

to be used in the $.ajax() call.

On Jun 16, 6:44 am, Rosa Spina <spina.r...@gmail.com> wrote:
> brian ha scritto:
>
> > 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.
>
> Does it work in mozilla, too?
> Thanks

Reply via email to