Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET MVC Ajax: Error with Ajax.Actionlink ('b.apply' is not a function in MicrosoftAjax.js)
    primarykey
    data
    text
    <p>I made some changes to my ajax test website and now my Ajax.ActionLinks don't work anymore! The ActionLinks in question are made like this:</p> <p>&lt;%=Ajax.ActionLink("Language Select", "LanguageScreen", "Home", from("LanguageScreen", "Functions"), meep("LanguageScreen", "Functions"))%>`</p> <p>The "from" and "meep" functions are only one liners as follows: </p> <pre><code>Function meep(ByVal act As String, ByVal cnt As String) As AjaxOptions Return New AjaxOptions With {.UpdateTargetId = "Content", .OnSuccess = "Hash('" + act + "', '" + cnt + "')", .LoadingElementId = "Loader", .OnComplete = "HideLoader", .OnBegin = "EmptyContent('" + act + "', '" + cnt + "')"} End Function Function from(ByVal act As String, ByVal cnt As String) Return New With {.fromAct = act, .fromCnt = cnt} End Function </code></pre> <p>When I click said button, Hash() executes okay</p> <pre><code> function Hash(ghz, ghzz) { set_action(ghz); set_controller(ghzz); window.location.hash = "#" + ghz + "." + ghzz; } </code></pre> <p>EmptyContent also works:</p> <pre><code> function EmptyContent(ghz, ghzz) { document.getElementById("Loader").style.visibility = "visible"; document.getElementById("main").style.backgroundColor = "#a0a0a0"; document.body.style.backgroundColor = "#3c6792"; return true; } </code></pre> <p>But then the process stucks somewhere. HideLoader() does not get called.</p> <p>This is the error thrown, including stack:</p> <pre><code>Uncaught exception:TypeError: 'b.apply' is not a function Error thrown at line 5, column 583 in &lt;anonymous function: Function.createDelegate&gt;() in http://ajax.sinni800.ath.cx/Scripts/MicrosoftAjax.js:return b.apply(a,arguments) called from line 15, column 1073 in &lt;anonymous function: Sys.Mvc.MvcHelpers.$2&gt;($p0, $p1, $p2, $p3, $p4) in http://ajax.sinni800.ath.cx/Scripts/MicrosoftMvcAjax.js:$7=$p4.onBegin($6)!==false; called from line 11, column 124 in &lt;anonymous function: Sys.Mvc.AsyncHyperlink.handleClick&gt;(anchor, evt, ajaxOptions) in http://ajax.sinni800.ath.cx/Scripts/MicrosoftMvcAjax.js:Sys.Mvc.MvcHelpers.$2(anchor.href,'post','',anchor,ajaxOptions); called from line 1, column 0 in &lt;anonymous function&gt;(event):Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'Loader', updateTargetId: 'Content', onBegin: Function.createDelegate(this, EmptyContent("Mine", "Home")), onComplete: Function.createDelegate(this, HideLoader()), onSuccess: Function.createDelegate(this, Hash("Mine", "Home")) }); </code></pre> <p>If you want, please search through my website if you find anything suspicious. I already looked if I defined b somewhere, but nothing. </p> <p>This is the URL: <a href="http://ajax.sinni800.ath.cx/" rel="nofollow noreferrer">http://ajax.sinni800.ath.cx/</a> . It listens to hashes, for example: <a href="http://ajax.sinni800.ath.cx/#Mine.Home" rel="nofollow noreferrer">http://ajax.sinni800.ath.cx/#Mine.Home</a> This is in the format Action.Controller. Another one: #Mines.Home.</p> <p>I hope somebody finds this. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload