Reputation: 2231
I've made a javascript function that produces a popup window but the popup is dependent with an id on another form so I was wondering this could be done. Here's what I've done so far:
$('.popupWindow').click(function () {
var model = { NameId: $('#NameId').val()}
myWindow = window.open('/Company/Edit/0?NameId=' + model, '',
'scrollbars=yes,width=500,height=500')
myWindow.focus()
});
This already create a popup window but the Id it gets returns object Object so the url for the popup screen becomes ~/Company/Edit/0?NameId=[object Object]
so obviously, it returns an error. What am I doing wrong here?
I'm using MVC 3 by the way. And I'm also using ActionLink (razr) for the view. Thanks.
Upvotes: 0
Views: 82
Reputation: 35983
Try to use instead of
NameId: $('#NameId').val()
this
NameId: $('#NameId').attr('id');
Upvotes: 0
Reputation: 4817
You created a model with a property NameId
, so instead of using model use this:
model.NameId
In your example it will look like this:
myWindow = window.open('/Company/Edit/0?NameId=' + model.NameId, '', 'scrollbars=yes,width=500,height=500')
Upvotes: 4