ajax - validateLogin is an undefined function.(javascript exception ) -


hi getting error undefined function think code alright can in case? please , suggest me tutorial getting data through webservice via ajax method.

<script type="text/javascript" language="javascript" src="scripts/jquery-1.4.1.js">    function validatelogin() {          $('input[type=button]').attr('disabled', true);         $("#login").html('');         var loginid = $('#txt_id').attr('value'); // username         var password = $('#txt_pwd').attr('value'); // password          $.ajax({              type: "post",             url: "webservice.asmx/validatelogin",             data: "lognid=" + loginid + "&password=" + password,             contenttype: "application/json; charset=utf-8",               success: function (result) {                     returnval = result.d;                     alert(returnval);                 },                  error: function (xmlhttprequest, textstatus, errorthrown) {                     returnval = '';                     },         });      }   </script> 

you can't link javascript source file , define code in same tag. split them 2 separate tags this:

<script type="text/javascript" src="scripts/jquery-1.4.1.js"></script> <script type="text/javascript">   function validatelogin() {          $('input[type=button]').attr('disabled', true);         $("#login").html('');         var loginid = $('#txt_id').attr('value'); // username         var password = $('#txt_pwd').attr('value'); // password          $.ajax({              type: "post",             url: "webservice.asmx/validatelogin",             data: "lognid=" + loginid + "&password=" + password,             contenttype: "application/json; charset=utf-8",               success: function (result) {                     returnval = result.d;                     alert(returnval);                 },                  error: function (xmlhttprequest, textstatus, errorthrown) {                     returnval = '';                     },         });      }   </script> 

citing mdn on issue:

src

this attribute specifies uri of external script; can used alternative embedding script directly within document. script elements src attribute specified should not have script embedded within tags.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -