asp按钮打开html页面,ColorBox弹出窗口上的Html或Aspnet按钮重定向到另一个按钮上的aspx页面点击...

如果您可以使用简单的html表单,在触发onsubmit时将该值添加到隐藏输入中,并将其发布到将为您重定向的web服务,该方法可能会容易得多。

总之:

你需要与另一个属性来装饰你的btnSaveData方法,改变返回值类型/参数字符串(或适合您需要的任何其他类型):

[ScriptMethod(ResponseFormat = ResponseFormat.Json)]

[WebMethod]

public static string btnSaveData(string color)

{

// do sth with the color

return "/SaveSuccess.aspx";

}

而在JS:

// retrieve the color as a string (this is up to you - I don't know what sort of ColorPicker you're using, so this is a placeholder)

function saveColor()

{

var color = $('#myColorPicker').color.toString();

// create the data for the webmethod,

// the parameternames have to be the same as they are on the WebMethod

var colorData = "{ color:'" + color + "'}";

$.ajax({

type: 'POST',

url: "/HomeLoan/ProductConfirmationPop_SaveData.aspx/btnSaveData",

contentType: 'application/json;charset=utf-8',

dataType: 'json',

data: colorData,

success: function (response) {

window.location.href = response.d; // redirect on success

},

error: function (response, text, error)

{

alert(response + ' ' + text + ' ' + error);

}

});

希望这有助于工作!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值