Javascript, Ajax and Alert Not Working -
i'm new javascript , ajax, , trying figure out why code below isn't working.
<script type="text/javascript"> $(document).ready(function() { $('.cadlib').bind('click', function () { $.get("/models/"+this.id+"/viewmodelinfo/", function(data) { alert ("yo"); // line bellow doesn't execute if (data.fact_type=="t") { guess_result="this fact true! " + data.fact_note; } else { alert ("yo"); guess_result="this fact false! " + data.fact_note; } $('#result').replacewith("guess_result"); }); }); }); </script>
here's html
<a href = "#mysymbolmodal" class = "cadlib" id = "{{symbol.id}}" data-toggle="modal" style = "text-align:center; color: #ff761a;" href="/models/{{symbol.id}}/view_model/"><span id = "modelname"> {{symbol.modelname.upper}}</span> - <span id = "format">{{ symbol.format }}</span><span id = "adder" style="visibility:hidden;">{{symbol.adder}}</span><span id = "adderid" style="visibility:hidden;"> {{symbol.adder.id}}</span><span id = "symbolobject" style="visibility:hidden;">{{symbol}}</span></a>
i think there wrong commented line. alert not instantiating.
is there i'm missing cause alert not work?
i guess 'this.id', try using on alert(this.id) before $.get see producing (or not).
i similar should give idea
$(".productpicturedelete").on("click", "input[type=button]", function(event){ var $buttonid = $(this).attr("id");
Comments
Post a Comment