jquery - uncaught type error:$ is not a function -
i have html page below , when select item on dropdown runs function. each time step through function , line
$("#ddlroute").html(procemessage).show();
i error : uncaught typeerror:$ not function
do know is? how resolve this?
@using (html.beginform()) { <div id="rowone-form"> <div class="section1"> <h2>select customer</h2> <div> <label for="branch">branch:</label> @html.dropdownlistfor(m => m.selectedbranch, model.branchlist, "select branch", new { @id = "ddlbranch", @style = "width:200px;", @onchange = "javascript:getroute(this.value);" }) </div> <div> <label>route:</label> <select id="ddlroute" name="ddlroute" style="width: 200px"></select> </div> </div> <hr /> <div class="form-buttons-sec" style="margin:35px;"> <input id="save1" type="button" value="save"/> <input id="cancel1" type="button" value="cancel" /> </div> } <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script language="javascript" type="text/javascript"> function getroute(_branchid) { var procemessage = "<option value='0'> please wait...</option>"; $("#ddlroute").html(procemessage).show(); var url = "/home/getroutebybranchid/"; $.ajax({ url: url, data: { branchid: _branchid }, cache: false, type: "post", success: function (data) { var markup = "<option value='0'>select city</option>"; (var x = 0; x < data.length; x++) { markup += "<option value=" + data[x].value + ">" + data[x].text + "</option>"; } $("#ddlroute").html(markup).show(); }, error: function (reponse) { alert("error : " + reponse); } }); } </script>
it seems url using obtain reference jquery may incorrect. try using 1 instead...
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
Comments
Post a Comment