I am trying to get a modal dialog which will be used to upload files to the server to display some content relative to the item selected in a grid. I'm getting errors in the jquery load method attempting to call my controller action. Initially the error I got was that it could not find the controller. I modified the path parameter in the load call with ~/ as a prefix and now the error is 'The HTTP verb POST used to access path '/EquipTrack/~/EquipTrak/GetEquipImages' is not allowed.' My breakpoint in the controller action never gets hit. I'm not sure what is the problem and I'm at my wits end. BTW, The dialog opens (without my content) then the error appears. I am willing to try another method to get my content in the dialog if needs be. Here is my code :(db call commented out in contrlr action) aspx: onClickButton: function() { var data = $("#equipgrid").getRowData(curRow);
jQuery('#img_dialog').load("~/EquipTrak/GetEquipImages", {}, function(responseText, textStatus, XMLHttpRequest) {
// XMLHttpRequest.responseText has the error info you want.
alert(XMLHttpRequest.responseText);
});
jQuery('#img_dialog').dialog('open');
return false;
},
<div id="img_dialog" title="Images for <%= ViewData["EquipID"] %>">
<% using (Html.BeginForm("Upload", "File", FormMethod.Post, new { enctype = "multipart/form-data" }))
{%>
<p><input type="file" id="fileUpload" name="fileUpload" size="23"/> </p>
<p><input type="submit" value="Upload file" /></p>
<p></p>
<center>
<ul style="list-style-type:none">
<li><%= ViewData["ImagePath"]%></li>
</ul>
</center>
<% } %>
</div>
controller: [AcceptVerbs(HttpVerbs.Post)] public ActionResult GetEquipImages() { string strEquipID = "30"; EquipTrak eqt = new EquipTrak();
ViewData["EquipID"] = strEquipID;
ViewData["ImagePath"] = "/Content/equip_images/sub_hoe1.jpg";
// ViewData["EquipImagePaths"] = eqt.GetEquipImages(strEquipID);
return View();
}