我试图填写一个网页,有一个单一的文本框和一个发送按钮的html看起来像这样

Send

我尝试使用mechanize提交带有此代码的表单

^{pr2}$

代码运行时没有错误,但是没有提交,我该怎么做?在

这是SendMessage函数function SendMessage() {

var text = $('#Text').val();

var userId = $('#RecipientId').val();

if (text.trim() === "")

{

$('#TextContainer').css('border-color', 'red');

}

else if (new RegExp("([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?(/.*)?").test(text))

{

$('#TextContainer').css('border-color', 'red');

$('#message').html("Links are not allowed in messages");

}

else

{

$('#Send').button('loading');

$.ajax(

{

url: '/Messages/SendMessage',

type: 'POST',

cache: false,

data:

{

__RequestVerificationToken: $('').attr('value'),

userId: userId,

text: text

}

});

}

}

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐