using a function in custom javascript file in drupal -


i made module creates block , using #attached added custom .js file block content, without drupal.behaviors , function($) things code works clock in page (outside of drupal) in drupal, have no idea how add function in .js file here codes:

(function($){     drupal.behaviors.mymodule = {     attach:function(context, settings) {                 function show_more(count){                 var counter = count;                 var id = document.getelementbyid("id").value;                 var xmlhttp;                 if (window.xmlhttprequest)                 {                     xmlhttp=new xmlhttprequest;                 }                 xmlhttp.onreadystatechange = function() {                 if(xmlhttp.readystate == 4 && xmlhttp.status == 200) {                     document.getelementbyid("div_id").innerhtml =xmlhttp.responsetext;                 }                 }                 xmlhttp.open("post","some_page.php",true);                 xmlhttp.setrequestheader("content-type","application/x-www-form-        urlencoded");                xmlhttp.send("counter="+encodeuricomponent(counter)+"&id="+encodeuricomponent(id    ));             $("#div_id").fadetoggle(2000);                }         }     }        })(jquery); 

i new drupal , jquery please me , please tell me how can call show_more function in content thank in advance

you can include js file theme or drupal_add_js($data = null, $options = null) function. write functions file , use simply. file , function available on whole website pages.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -