Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed Help in to write jQuery function
    primarykey
    data
    text
    <p>I need some help in implementing jQuery.</p> <p>I have a dropdown list with the following code</p> <pre><code>&lt;td width="20%"&gt;Programs&lt;font color="red"&gt;*&lt;/font&gt;:&lt;/td&gt; &lt;td width="20%"&gt;&lt;c:set var="programMap" value="${userTraining.programMap}"&gt;&lt;/c:set&gt; &lt;form:select path="programs" id="selectPrograms" onchange="javascript:checkboxlist();"&gt; &lt;c:forEach var="item" items="${programMap}"&gt; &lt;form:option value="${item.key}"&gt; &lt;c:out value="${item.value}"&gt;&lt;/c:out&gt; &lt;/form:option&gt; &lt;/c:forEach&gt; &lt;/form:select&gt;&lt;/td&gt; </code></pre> <p>On the change event of my drop down list (javascript function "checkbox()" gets called), and the function fetches course list and display that list "course" tab in checkbox form.</p> <pre><code>function checkboxlist() { document.userTrainingForm.action = "/UserRegistration/training/main/student/getCourses"; document.userTrainingForm.submit(); } </code></pre> <p>Course tab code snippet</p> <pre><code>&lt;c:set var="courseMap" value="${userTraining.courseMap}"&gt;&lt;/c:set&gt; &lt;c:set var="selectedCourseMap" value="${userTraining.selectedCourseMap}"&gt;&lt;/c:set&gt; &lt;c:forEach var="item" items="${courseMap}"&gt; &lt;c:set var="valuePresent" value="false"&gt;&lt;/c:set&gt; &lt;c:forEach var="selectitem" items="${selectedCourseMap}"&gt; &lt;c:if test="${selectitem.key == item.key}"&gt; &lt;c:set var="valuePresent" value="true"&gt;&lt;/c:set&gt; &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;c:choose&gt; &lt;c:when test="${valuePresent == 'true'}"&gt; &lt;form:checkbox id="chkCourse" path="courseName" checked="checked" value="${item.key}" style="font-weight: 700" /&gt; &lt;c:out value="${item.value}"&gt;&lt;/c:out&gt; &lt;/br&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;form:checkbox id="chkCourse" path="courseName" value="${item.key}" style="font-weight: 700" /&gt; &lt;c:out value="${item.value}"&gt;&lt;/c:out&gt; &lt;/br&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; </code></pre> <p>Page is getting refreshed on every On Change event. Can somebody please help me to write "function checkboxlist()" in jQuery <strong><em>(jQuery.ajax())</em></strong> , so that page doesn't get refreshed on every onchange event. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload