AlexGH AlexGH - 1 year ago 183
Ajax Question

Ajax not recognized in JQuery file

I uploaded to GitHub days ago an MVC project, I've downloaded it again, and want to set some new functions using JQuery Ajax, but now when I'm trying to do something like this:

$("#btnTrigger").click(function () {
type: "get",
url: "/Orders/MyJson/"
}).success(function (result) {

An exception is thrown:
Object doesn't support property or method 'success'
I think that something is wrong with JQuery, when I'm going to write
inside a function the keyword
is not displayed, instead Intellisense shows other keywords like
etc. Normally the keyword
is displayed from Intellisense.
I've been trying uninstaling and installing JQuery again and nothing happened, I've check the BundleConfig class to check if the JQuery files are added and they are there, I've installed unobtrusive ajax and have added it to BundleConfig class too and still the problem continues... What it could be??

Answer Source

Try it like this, putting the success inside ajax definition

$("#btnTrigger").click(function () {
            type: "get",
            url: "/Orders/MyJson/",
            success: {
                function (result) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download