Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery .getJSON function needs to rebind returned data
    primarykey
    data
    text
    <p>I am having trouble getting my modal window function to bind to some returned data. I am using Cody Lindy's http://swip.codylindley.com/DOMWindowDemo.html">Jquery.DomWindow plugin. Please note that everything functions properly, except for this problem.</p> <p>The problem occurs when the data that is returned from my jQuery.getJSON call contains a link that is supposed to open up the modal window. The link however, is not recognised by the DOM and therefore is not bound by any function. </p> <p>My jQuery function is:</p> <pre><code>$(".deleteThis").live("click", function(){ var $this = $(this); $.getJSON(this.href, function(data) { if( data.success == '1') { $this.parent().html('&lt;span style="background:#f1ffd6;padding:5px;"&gt;' +data.msg+'&lt;/span&gt;'); } else if( data.success == '2') { $this.parent().html('&lt;span style="background:#f1ffd6;padding:5px;"&gt;' +data.msg+'&lt;/span&gt;'); } else {alert("Failure (most likely our fault).");} }); return false; }); </code></pre> <p>The php script that jQuery sends to contains some database scripting (not shown below as it is not relevant). The relevant php code that returns the JSON array is this:</p> <pre><code>if($del ==1 ){ $msg= "$name has been deleted. (&lt;a href='media/delete_coll.php?cid=$cid&amp;delete=0' class='deleteThis' &gt;undo&lt;/a&gt;)"; print json_encode(array("success" =&gt; 1,"msg" =&gt; $msg)); } if($del ==0 ){ $msg= "$name &lt;a href='media/editCollab.php?coll=$coll_id' class='absoluteIframeDOMWindow'&gt;edit&lt;/a&gt; &lt;a href='media/delete_coll.php?cid=$coll_id&amp;delete=1&amp;coll=$coll' class='deleteThis' &gt; delete&lt;/a&gt; | Collaborator has restored."; print json_encode(array("success" =&gt; 2, "msg" =&gt; $msg)); } </code></pre>
    singulars
    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.
 

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