I am using a Modal Bootstrap Class to have a user fill out some forms and then have a "complete" button at the end to submit the answers to the forms:
<button type="submit" id="submitCallScriptBtn" onclick="submitInitialCallScript(this);"
data-ptKey="@Model.Patient.PtKey" data-assignedTaskKey="@Model.Tasks[0].TassKey"
class="btn btn-primary">Complete Initial Call</button>
So, when a user clicks the submit button, I want to call a JavaScript function from a separate JavaScript File called 'PatientSearch.js':
function submitInitialCallScript(elem) {
console.log("This Method is running");
var e = document.getElementById("communication");
var eResponse = e.options[e.selectedIndex].text;
var ptKey = $(elem).data('ptKey');
var assignedTasakKey = $(elem).data('assignedTaskKey');
$.ajax({
type: 'GET',
dataType: 'text',
url: '~/PatientController/SubmitInitialCallScript',
data: {
ptKey: ptKey,
tass_Key: assignedTaskKey,
question1: $("input[name=goodtime]:checked").val(),
question2: $("input[name=startedDevice]:checked").val(),
question3: $("input[name=driver]:checked").val(),
question3a: $("input[name=comfort]:checked").val(),
question4: $("#concerns").val(),
question5: $("input[name=occupation]:checked").val(),
question6: $("input[name=appointmentscheduled]:checked").val(),
question6a: $("#doctor").val(),
question6b: $("#appointDate").val(),
question7: $("input[name=selfTracking]:checked").val(),
question8: $("input[name=understand]:checked").val(),
question9: eResponse,
question10: $("#otherQuestions").val()
}, success(data) {
if (data == "true")
window.location.assign("~/Controllers/Patient/Index");
else
alert("Error Submitting");
}, failure(data) {
alert("Error Submitting")
}
})
However, I can not get my JavaScript Method to run. When I click my button, nothing happens..even though the files are linked up correctly:
Is there something wrong I am doing? Is there a different way to call JavaScript Method and I am doing it incorrectly?
EDIT:
Here are some screenshots of the Web ToolKit Errors:
Here you see PatientSearch.js not even in the file structure even though it is the same you see in Visual Studio.