Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

responseText not evaluated ....

$
0
0

Source is https://www.learnrazorpages.com/razor-pages/ajax/unobtrusive-ajax

When I run it, the alert pops BUT the alert does not evaluate xhr.responseText but processes it as literallyHi ${xhr.responseText}

I notice that the failure mode doesnt use $ in front of the { xhr variable }. I did try removing the $ but no difference. The syntax reminds me of the $ and  { variable} in C#.

I know ajax unobtrusive is installed because data-ajax-confirm does fire on an earlier example from the above site.

Any idea on how the code is made to work ?

@section scripts
{
<script src="~/lib/jquery-ajax-unobtrusive/dist/jquery.unobtrusive-ajax.min.js"></script>
<script>
completed = function (xhr) {
alert('Hi ${xhr.responseText}');
};
</script>
<script>
failed = function (xhr) {
alert('Status: {xhr.status}, Status Text: {xhr.statusText}');
};
</script>

}

Thanks !


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>