我如何...使用jquery从一个屏幕导航到另一个屏幕。 [英] How do I...Navigate from one screen to another using jquery.

查看:88
本文介绍了我如何...使用jquery从一个屏幕导航到另一个屏幕。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个屏幕,我正在使用jtable网格。我从网格中选择行。现在屏幕有一个按钮重新分配点击我要导航/返回另一个视图并将这些选定的行从网格传递给动作方法,该方法返回另一个视图。



以下Jquery代码能够从Home控制器调用GridDemo actionmthod甚至传递选定的行,但我的问题是它不会返回另一个View并保留在第一个View本身,我想这是一个ajax请求。



有谁可以帮助我如何实现这一目标?(将数据发送到actionmethod但返回另一个视图)

谢谢adavnace !!





我在按钮重新分配的clcik上的jquery代码如下:



$(#reassign)。click(function(){

var $ selectedRows = $('#PersonTable')。jtable('selectedRows');

调试器;

$('#SelectedRowList')。empty();

var batch = [];



if($ s electionsRows.length> 0){//显示选定的行



$ selectedRows.each(function(){



var record = $(this).data('record');

debugger;

batch.push({BatchType:record.BatchType,LOBType:record.LOBType,Platform :record.Platform,RecieptDate:record.RecieptDate});

});



$ .ajax({

类型:'post',

url:'/ Home / GridDemo',

数据:JSON.stringify(批处理),

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

成功:函数(数据)

{debugger;(#Content)。 html(data)}

});


}

else {

$(' #lab1')。Visible = true; //没有选择行

$('#lab1')。text('没有选择行!选择行看这里......');

}

});

解决方案

(#reassign)。click(function(){

var


selectedRows =


('#PersonTable')。jtable('selectedRows');

调试器;

Hi,

I have a screen in which I am using a jtable grid. I select the rows from the grid. Now screen has a button Reassign on click of which I want to navigate/ return another View and pass those selected rows from the grid to the actionmethod which is returning another view.

Below Jquery code is able to call GridDemo actionmthod from Home controller even pass the selected rows, but my problem is that it doesn't return another View and remains on the first View itself, I guess as it's an ajax request.

Could anyone help me how this can be acheived?(sending data to actionmethod but return another view)
Thanks in adavnace!!


My jquery code on clcik of button Reassign is as below:

$("#reassign").click(function () {
var $selectedRows = $('#PersonTable').jtable('selectedRows');
debugger;
$('#SelectedRowList').empty();
var batch = [];

if ($selectedRows.length > 0) { //Show selected rows

$selectedRows.each(function () {

var record = $(this).data('record');
debugger;
batch.push({ BatchType: record.BatchType, LOBType: record.LOBType, Platform: record.Platform, RecieptDate: record.RecieptDate });
});

$.ajax({
type: 'post',
url: '/Home/GridDemo',
data: JSON.stringify(batch),
contentType: "application/json; charset=utf-8",
success: function (data)
{ debugger; ("#Content").html(data) }
});

}
else {
$('#lab1').Visible = true; //No rows selected
$('#lab1').text('No row selected! Select rows to see here...');
}
});

解决方案

("#reassign").click(function () {
var


selectedRows =


('#PersonTable').jtable('selectedRows');
debugger;


这篇关于我如何...使用jquery从一个屏幕导航到另一个屏幕。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆