JS code check for browser compatibility

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pankajit09
    Contributor
    • Dec 2006
    • 296

    JS code check for browser compatibility

    Please tell me whether the below JS code will run in all the browsers -->

    Code:
    function getHTML(num) {
            var saf = 0 ;
            var num;
            if(!num) {
                num = document.getElementById('refid').value;
            } else {
                num = num;
            }
    	    var url = '/cgi-bin/ptts/search.cgi';
    		var pars = 'num='+num+'&showallfiles='+saf+'&act=showattachedfilesection';
            var myAjax = new Ajax.Updater( {success: 'placeholder'}, url, { method: 'get', parameters: pars, onFailure: reportError });
        }
  • b1randon
    Recognized Expert New Member
    • Dec 2006
    • 171

    #2
    Originally posted by pankajit09
    Please tell me whether the below JS code will run in all the browsers -->

    Code:
    function getHTML(num) {
            var saf = 0 ;
            var num;
            if(!num) {
                num = document.getElementById('refid').value;
            } else {
                num = num;
            }
    	    var url = '/cgi-bin/ptts/search.cgi';
    		var pars = 'num='+num+'&showallfiles='+saf+'&act=showattachedfilesection';
            var myAjax = new Ajax.Updater( {success: 'placeholder'}, url, { method: 'get', parameters: pars, onFailure: reportError });
        }
    Everything looks fine but you haven't included the code behind your Ajax object. If you post that perhaps someone will be able to tell you.

    Comment

    • pankajit09
      Contributor
      • Dec 2006
      • 296

      #3
      Originally posted by b1randon
      Everything looks fine but you haven't included the code behind your Ajax object. If you post that perhaps someone will be able to tell you.

      Is it mandatory that the data returned by the Perl script should be in XML format as Ajax transactions are through XML ?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Not necessary. It depends on how you parse/deal with it on the client-side. See a non-XML server response example here.

        Comment

        Working...