Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I have another trouble in my project, I am trying to do an AjaxForm, but is not working, anyone knows what could be that?, here is my code...
HTML
@Ajax.ActionLink("Create", "Create" , new AjaxOptions()
{
    UpdateTargetId = "UpdateContent",
    InsertionMode = InsertionMode.Replace
} )

<div id="UpdateContent" style="text-align: center">
    
</div>

@section scripts
{
    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
}


I have been trying to use Ajax in Asp.Net MVC 5 but it was in vain, i have included jquery.unobtrusive-ajax.min and everything, when i include everything and run the project, Visual Studio shows me this:

"Unhandled exception at line 5, column 2 in http://localhost:4194/Scripts/jquery.unobtrusive-ajax.min.js
0x800a1391 - Javascript Runtime Error: 'jQuery' is not defined"
Posted
Updated 23-Sep-14 9:09am
v3
Comments
Sergey Alexandrovich Kryukov 22-Sep-14 18:55pm    
Why do you have both *.js and *min.js at the same time? How could it possibly work?
—SA
[no name] 22-Sep-14 23:17pm    
Its better to use the min.js only as it is minified and will load faster.

Hi,

The above code seems fine.Just want to confirm if you are including the below scripts?

jquery-1.7.1.min.js
MicrosoftAjax.js
MicrosoftMvcAjax.js
 
Share this answer
 
The Console from the browser might tell you the error that is actually causing a trouble. You can use that console from the browser, by pressing the F12 key and then going to the Console.

Each error is displayed inside the console, to tell the developer what is an error in the website. Ajax errors, indirectly are the JavaScript errors that were caused and were the reasons for non executing a command set (function).

You can open the console, and then check what the Console is complaining when you try to send a request. It will trigger an error, if it doesn't. Make sure you're selecting correct element to run the request.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900