Solved

Getting a textbox value and carrying it over to anouther page in javascript

Posted on 2011-09-28
1
146 Views
Last Modified: 2012-05-12
Ok so i use JavaScript to have my output from textbox show in realtime
<script type="text/javascript" >
    $(function () {
        $(".submit,#submit").click(function () {
            var comment = $("#textbox").val();
            var dataString = '&comment=' + comment;
            if (comment == '') {
                alert('Please Give Valid Details');
            }
            else {
                $("#flash").show();
                $("#flash").fadeIn(400).html('<img src="ajax-loader.gif" />Loading Comment...');
                $.ajax({
                    async: false,
                    type: "POST",
                    url: "Default2.aspx",
                    data: dataString,
                    cache: false,
                    success: function (html) {
                        $("div#update").append(html);
                        $("div#update li:last").fadeIn("slow");
                        $("#flash").hide();
                    }
                });
            } return false;
        });
    });

    </script>

Open in new window


how would i display var comment  and enter it into my db using vb.net?
0
Comment
Question by:runnerjp2005
1 Comment
 
LVL 28

Accepted Solution

by:
strickdd earned 500 total points
ID: 36716791
I believe you are working under the assumption that the $.ajax() call will redirect the current page to the "Default2.aspx" page. If this assumption is correct, this is where the main part of your problem is. The ajax call will not perform the redirect for you, it merely calls a service and posts data to it.

Ideally, when using web forms, you will want to create an actual Web Service (.asmx) file to post to using the ajax call. Then you can return a JSON result to be processed by the page on the callback.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now