javascript - How to hit the database on the function? -


i have quesion can hit database on view?

i have function this..

  function showhipaatab(url) {              if ($("#bxflag").val() == "1") {                 $("#bv-1").attr('src', url);             } else {                 return false;             }         }; 

on funcation need hit database bxflag value.how that?

so being javascript running in browser not server, don't have direct access database. depending on situation there couple ways can value:

  • if value known @ time render page can set javascript variable value in view. has advantage of being simple , not requiring additional call server.
  • if value can not known until after render, or if can change during lifetime of page use jquery ajax gov points out.

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -