I have a piece of code that returns success or error response based on Ajax call.
The alert and all is working fine.
How do i reload the same page from server after this call? Does location.reload does the trick?
$.ajax({
type: "POST",
url: "/ChurnFB/InsertQuestionnaireForExistingClCode",
data: JSON.stringify(questions),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
if(response.success)
alert(response.responseText);
(responseText is return of JSON coming from Controller action method.)
}
});
I want to achieve two things :
a> Refreshing the same page.
b> Make the border color of TextBoxes having errors return to normal default style.
This is the Javascript code for which i want the border style to return to default.
question.CLCode = document.getElementById('valCLCode').value;
question.QSerial = document.getElementById("txtQserial" + counter).value;
HTML code for which i want borderColor to return from red to normal:
<div id="insertDiv" class="row-fluid" style="display:none;">
<div class="row" style="margin-left:0px;">
<div class="col-12">
<div class="widget-box">
<div class="widget-content nopadding">
<table id="tblQuestion" class="table">
<thead>
<tr>
<th>QSerial</th>
<th>QGroup</th>
<th>Question</th>
<th>Description</th>
<th>AnswerType</th>
<th>ManualEntry</th>
<th>ScriptName</th>
<th>ParameterString</th>
<th>ValidFrom</th>
<th>ValidTill</th>
<th></th>
</tr>
</thead>
<tbody id="insertBody">
<tr id="tablerow0">
<td><input style="max-width:50px;" type="text" id="txtQserial0" placeholder="Qserial" required="required" /></td>
<td><input style="max-width:100px;" type="text" id="txtGroup0" placeholder="QGroup" required="required" /></td>
<td><textarea style="max-width:110px;" type="text" id="txtQuestion0" placeholder="Question" required="required"></textarea></td>
<td><textarea style="max-width:110px;" type="text" id="txtDescription0" placeholder="Description" required="required"></textarea></td>
<td>
<select style="max-width:110px;" id="ddlAnswerType0">
<option value="S" selected>Select Any</option>
<option value="N">Number</option>
<option value="T">Text</option>
<option value="C">CheckBox</option>
</select>
</td>
<td><input style="max-width:50px;" type="checkbox" id="chkManualEntryChkBox0" /></td>
<td><textarea style="max-width:110px;" type="text" placeholder="Script Name" id="txtScriptName0"></textarea></td>
<td><textarea style="max-width:110px;" type="text" placeholder="Parameter String" id="txtParameterString0"></textarea></td>
<td><input style="max-width:140px;" type="date" placeholder="Parameter String" id="validFrom0" /></td>
<td><input style="max-width:140px;" type="date" placeholder="Parameter String" id="validTill0" /></td>
<td><i id="addNewRow" style="cursor: pointer;color:grey; font-size: 25px;padding: 2px; display:block;" class="fas fa-plus-circle" aria-hidden="true"></i></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
What I have tried:
Googling some basic CRUD operations. Also tried using abort method but not much helpful.