TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Schleid Alex
NA
361
48.2k
Jquery external file problem
Apr 30 2020 5:59 AM
Hi
I have this script that works fine when placed in the view directly,
$(document).ready(function () {
$('#btnSearch').on('click', function () {
var strSearch = $('#Search').val()
$.ajax({
url: '@Url.Action("SearchAccountByNumber", "AccountDetails")',
type: 'GET',
contentType: 'apllication/html; charset=utf-8',
data: { 'strAccountNumber':strSearch },
dataType: 'html',
success: function (result) {
$('#dvAccountDetails').html(result)
$('#dvAccountTransactions').empty()
}
})
})
})
but on I move it to an external js file and reference the file in the view it doesn work, the url turn into something like this.
https://localhost:44332/AccountDetails/@Url.Action(%22SearchAccountByNumber%22,%20%22AccountDetails%22)?strAccountNumber=111-2340-908
thank you for your help.
Reply
Answers (
1
)
How to implement BoDetect Captcha in .net core 3.1 mvc ?
can i prefix something to Response.Redirect