Вызов c# функции в javascript файле в asp.net.mvc
Помогите пожалуйста, что я делаю не так?
js file:
var scannedImg = Q("#scanned-img"),
scannedQR = Q("#scanned");
var args = {
resultFunction: function (res) {
scannedImg.src = res.imgData;
scannedQR[txt] = res.code;
if (PageMethods.CalledMethod(res.code) = "Да") {
document.location.replace("/Storekeeper.aspx");
}
},
c# file:
[WebMethod()]
[System.Web.Script.Services.ScriptMethod()]
public static string CalledMethod(string v)
{
string variable = v;
if (variable == "123")
{
return "Да";
}
else
{
return "Нет";
}
}
<div class="well" style="overflow: hidden;">
<img width="320" height="240" id="scanned-img" src="">
</div>
<div class="caption">
<h3>Scanned result</h3>
<p id="scanned"></p>
</div>