简体   繁体   中英

jQuery Mobile Page function

 $(document).on("pageshow", "#mappage", function (event) {
    $("#doldur").append("<li> <label onclick='getBina(" 
                        + featuressokak[f].attributes.SOKAKID 
                        + ");'>" 
                        + featuressokak[f].attributes.SOKAKADI 
                        + "</label><div  onclick='findsokak(" + f + ");' style='float:right;width='20%''><img  src='img/map.png'   style='float:right;'/></div></li>");

    function getBina(sokakid) {}
 });

I wrote part of my code. I need to call function getBina inside on mappage function. But I got this error : uncaught ReferenceError: getBina is not defined. So when I wrote function getBina outside mappage function, logicically I got error. I must run on inside. how is it possible ?

my button code :

 var content = '<div class="adresbaslik">'+feature.attributes.ADI+'</div><p style="margin-top:-10px"></p><div class="fulladrespopup">'+mahalleadi+' MAHALLESİ '+sokfeature[0].attributes.SOKAKADI +' SOKAK NO:' + numfeature[0].attributes.KAPINO  +' '+ilceadi+'</div>' ;  
                                content = content + '<p style="margin-top:-10px"></p><div style="text-align: center ;"><a data-ajax="false" onclick="sendForm(&quot;'
                                +ilceadi+'&quot;,&quot;'
                                +mahalleadi+'&quot;,&quot;'
                                +sokfeature[0].attributes.SOKAKADI+'&quot;,&quot;'
                                + numfeature[0].attributes.KAPINO+'&quot;,&quot;'
                                + ilcegisID+'&quot;,&quot;'
                                + mahallegisID+'&quot;,&quot;'
                                + sokgetir[0].attributes.GIS_ID+'&quot;,&quot;'
                                + numfeature[0].attributes.KAPINO+'&quot;,&quot;'
                                + feature+'&quot;'
                                +');" class="formgidin" >Bildirim</a></div>';

write the definition of the function then only it will remove the error "getBina is not defined". You can write the function globally or you can write function locally.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM