PHP Variable inside .attr String -


i can't figure syntax of placing php variable inside string. code follows:

if( /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.useragent) ) {        jquery('#pinfo').attr('href','mailto:mobile@domain.com?subject=' .  get_the_title() );         jquery('#pinfo').attr('class','pullup');   }; 

get_the_title() not being displayed , code seems break current syntax.

when use php alongside javascript, php gets executed before javascript does. write code so:

if( /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.useragent) ) {        jquery('#pinfo').attr('href','mailto:mobile@domain.com?subject=<?=get_the_title()?>');         jquery('#pinfo').attr('class','pullup');   }; 

once browser renders page, leave javascript looks (which browser needs):

if( /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.useragent) ) {        jquery('#pinfo').attr('href','mailto:mobile@domain.com?subject=my page title');         jquery('#pinfo').attr('class','pullup');   }; 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -