I have a MVC 3 application. I want to display the result I just created.
Some of the code for Controller and View.
public ActionResult ViewGenerated(string Number, string ClientID)
{
// get a list of inmate id\'s and pins from batch number
string url = HttpContext.Request.Url.ToString();
int client;
client = int.Parse(ClientID);
int batch = int.Parse(Number);
var list = (from a in aContext.aDetail
select a).ToList();
// set this to the object collection
ViewBag.x = list;
return View();
}
Then View
@foreach (var r in ViewBag.x)
{
<tr>
<td>@r.ID</td>
<td>@r.Name</td>
</tr>
In my javascript code I call a WCF and return the number and I try to pass it the controller??
function GenerateX() {
// blah blah
$.getJSON(\'/some service\', function (response) {
});
// What I want is to get the number from the service then redirect the url to the view
$(this).dialog(\'close\'); // Close it
}
I used a jquery dialog to call \”GenerateX\”.
I am not sure how to do it, I am not strong on this area.
Many thanks.
updated:
$.getJSON(\'/Services/InService.svc/blah/GeneratePINs/\').success(viewPins);
// return \"Number\" here and want to pass it to controller.
$(this).dialog(\'close\'); // Close it
}
function viewPins(data) {
var clientId = $(\"#clientIds\").val();
alert(clientId); // code not reach here
window.open(\'/WebAdminOrion/blah/ViewGeneratedPINs?Number=\' + data + \'?&ClientID=\' + clientId);
}





Rating:
The post jquery – Redirect an url(view) in js dialog appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/jquery-redirect-an-urlview-in-js-dialog.html
No comments:
Post a Comment