开发者

how do I post data onto an aspx page

I have a jquery script which is installed in a browser which works like this:

when an image is hovered, it checks that whether an alternative text for that image is present or not. if there is no such text then on clicking the image a dialog box(jquery dialog box) is opened and it asks the user to add the alternative text into a textbox (on the dialog box) and when the user presses "send your proposal" button then this is where I want help.

I want to add this 开发者_运维百科data into my database sqlserver. I heard this somewhere that if I can make an aspx page then from there I could send the data into the database. Because we cannot do this in one go. If yes then you are most welcome to answer.

Here is the jquery code.

$(function() {

  $('body').append('<div id="dialog-form" />');

  $('#dialog-form').append('<p>Add an alternative text for the image</p>');
  $('#dialog-form').append('<form></form>');
  $('#dialog-form form').append('<input type="text" value="" name="addalt" />');

  $.each($('img'), function() {

        if($(this).parent()!='a') {

            $(this).wrap('<div class="project_addalt ui-corner-all" />');           

        } else {

            $(this).parent().wrap('<div class="project_addalt ui-corner-all" />');          

        };

        if($(this).attr('alt')==""){

            $(this).parent('div')
                .addClass('ui-state-error')
                .width($(this).width())
                .append('<div class="addalt_overlay ui-state-error" style="display:none"><p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>This image has no alternative text! Click here to add...</p></div>');

        } else {

            $(this).parent('div')
                .width($(this).width())
                .append('<div class="addalt_overlay" style="display:none"><p>'+$(this).attr('alt')+'</p></div>');       

        }

    }

  );


    $('.addalt_overlay').click(
        function(){
            $('#dialog-form').dialog('open');   
    });

  $.each($('.project_addalt'), function() {

    $(this).hover(
        function(){
            $(this).children('div').show(300);
        },
        function(){
            $(this).children('div').hide(300);
        });

    });

        $( "#dialog-form" ).dialog({
            autoOpen: false,
            height: 300,
            width: 350,
            modal: true,
            buttons: {
                "Send your proposal": function() {
                    },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            },
            close: function() {
                allFields.val( "" ).removeClass( "ui-state-error" );
            }
        });



});


Just make an AJAX request using jquery to the specific aspx page passing the data as querystring (easiest)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜