Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery pop-up doesnt work from Ajax
    primarykey
    data
    text
    <p>this code works perfectly on page and opens popup, but where I call it from Ajax it doesnot work. I tried then, to call some simple function fff() and even it not work from ajax. It write its not defined.</p> <p>this is the popup function:</p> <pre><code>$(document).ready( function(){ //open popup $(document).on("click", ".pop", function(){ var url = $(this).attr('name'); $("#"+url).fadeIn(1000); positionPopup(this); }); //close popup $(document).on("click", ".close", function(){ var url = $(this).attr('name'); $("#"+url).fadeOut(500); }); }); function popupFun() { $(".pop").click(function(){ var url = $(this).attr('name'); $("#"+url).fadeIn(1000); positionPopup(this); }); //close popup $(".close").click(function(){ var url = $(this).attr('name'); $("#"+url).fadeOut(500); }); } //position the popup at the center of the page function positionPopup(element){ var url = $(element).attr('name'); if(!$("#"+url).is(':visible')){ return; } $("#"+url).css({ left: ($(window).width() - $('#'+url).width()) / 2, top: ($(window).width() - $('#'+url).width()) / 7, position:'absolute' }); } //maintain the popup at center of the page when browser resized $(window).bind('resize',positionPopup); &lt;/script&gt; &lt;style&gt; .overlay_form{ position: absolute; border: 0px solid gray; padding: 0px; background: ; width: 400px; height: 500px; } .pop{ display: inline; border: 0px solid gray; width: 65px; text-align: center; padding: 6px; border-radius: 5px; text-decoration: none; margin: 0 auto; } &lt;/style&gt; </code></pre> <p>this code is called from ajax: </p> <pre><code>&lt;script type="text/javascript" src="include/jquery-popup/jquery-1.6.1.min.js"&gt;&lt;/script&gt; &lt;? require_once('include/popup_functions.php'); ?&gt; &lt;script type="text/javascript" &gt; alert('0'); function fff() { alert('hi'); } &lt;/script&gt; &lt;? echo "&lt;br&gt;&lt;table style='width:80%' class='blue-table' border=2 &gt;"; $result_fields_list=array("name","care_giver_kind_id","service","branch","cg_profile"); foreach($res_list as $name=&gt;$det) { echo "&lt;tr&gt;"; foreach($result_fields_list as $field) { echo "&lt;td&gt;"; if($field=="branch"&amp;&amp;$det['branch_id']) { $j++; ?&gt; &lt;nobr&gt;&lt;a href='#' onclick="alert(1);fff(); " id="pop" class="pop" name='&lt;?='overlay_form'.$j?&gt;' &gt;&lt;?=get_bc_branch_name($det['branch_id'])?&gt;&lt;/a&gt;&lt;/nobr&gt; &lt;div class="overlay_form" id='&lt;?="overlay_form".$j?&gt;' style="display:none"&gt; &lt;? $_GET['b_id']=$det['branch_id']; include('bc_branch_profile.php'); ?&gt; &lt;/div&gt; &lt;? } echo "&amp;nbsp &lt;/td&gt;"; } echo "&lt;/tr&gt;"; } echo "&lt;/table&gt;"; </code></pre> <p>}</p> <p>Thank You!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload