English 中文(简体)
人口动态下降
原标题:dynamically populating a drop down based on selection of one dropdown

我正试图根据另一个下降的挑选情况,把一人降为一例。 我正在利用休战框架,并利用 j解决上述问题陈述。 我的代码在使用“json()”方法向服务器发出“GET”电话时 st。 能够帮助我。

我的支部法典:

<div id="Symptoms" style="display:none;">
<html:form id="iamhere" method="POST" action="symptoms" >
<p></p>
<p>Enter/Choose ailment : 

<select id="diselc" name="AuthoringForm"  size="1" >
<option selected="selected"> </option>
<option>Malaria</option>
<option>High Fever</option>
<option>Cholera</option>
<option>Diarrhoea</option>
</select></p>
<p>Choose ailment classification : 
<select id="diselchild" name="AuthoringForm" > 
<option>High</option>
<option>Medium</option>
<option>Low</option> 
</select> 



<fieldset style="width: 381px; height: 126px; padding: 2">
<legend align="left"></legend>
 Tick off patient context :
<html:radio value="Men" name="AuthoringForm" property="patient_context" disabled="false"/>
Men
<html:radio value="Womwen" name="AuthoringForm" property="patient_context" disabled="false"/>
Women
<p>
<html:radio value="Child" name="AuthoringForm" property="patient_context" disabled="false"/>
Child
<html:radio value="Al" name="AuthoringForm" property="patient_context" disabled="false"/>
All
</fieldset>
<p>Enter Pre Conditions</p>
<p><html:textarea rows="2" name="AuthoringForm" cols="20" property="patient_precondition" ></html:textarea>
<p>Must Have Symptoms : 
May Have Symptoms :</p>
<p><html:textarea rows="2" name="AuthoringForm" cols="20" property="must_have_symptoms"></html:textarea>
<!-- <input type="submit" value="Submit" name="B2">-->
<html:textarea rows="2" name="AuthoringForm" cols="20" property="may_have_symptoms"></html:textarea>
<input type="submit" value="Submit" name="symptomsButton"><input type="reset" value="Reset" onclick="clear_form_elements(this.form);"></p>
</html:form>
</div>

我的笑:

<script> 
            $(document).ready(function() { 
                $("#diselc").change(function(){ 
                    fillOptions( diselc , diselchild ); 
                    }); 
            }); 
            function fillOptions(parentId,ddId) {
                alert("atleast the call is being made in the fillOptions"+ddId);
                var dd = $( #  + ddId); 
                alert("the value being passed is "+dd);
                var jsonURL =  http://localhost:8080/docRuleTool/decisiontreeAction.do?dd=  + ddId +  &val=  + $( #  + parentId +   :selected ).val(); 
                $.getJSON(jsonURL, function(opts)
                {
                alert("just after calling the servlet stuff ");
                    $( >option , dd).remove(); // Clean old options first. 
                    if (opts) { 
                        $.each(opts, function(key, value) { 
                            dd.append($( <option/> ).val(key).text(value)); 
                        }); 
                    } else { 
                        dd.append($( <option/> ).text("Please select parent")); 
                    } 
                }); 
            } 
 </script> 

能够帮助我。

问题回答

如@meloncholy所述,错误的回击

$.getJSON(jsonURL, function() {
 //your code here
  alert("success");
})
.error(function(jxhr) { alert(jxhr.ResponseText); });

see if the error handler gets called...





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签