Details
-
Type:
Patch
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 1.10.5
-
Fix Version/s: 1.11.8
-
Component/s: ZendX_JQuery
-
Labels:
Description
When 'inline' key are used - html output is incorrect!
This code:
<?php echo $this->ajaxLink( '[Delete]', $this->url(array('action' => 'delete', 'id' => $entry->id)), array( 'dataType' => 'json', 'noscript' => true, 'beforeSend' => 'if(!confirm("Do you really want to delete this item?")) {return false;}$("#progress-bar").show();', 'complete' => '$("#progress-bar").hide();$("#entry-' . $entry->id . '").hide("slow");', 'inline' => true ), array('format' => 'json') ) ?>
produces:
<a href="/index/delete/id/57" onclick='if(!confirm("Do you really want to delete this item?")) {return false;}$("#progress-bar").show();$.post('/index/delete/id/57', {format:"json"}, function(data, textStatus) { $("#progress-bar").hide();$("#entry-57").hide("slow"); }, 'json');return false;'>[Delete]</a>
Just replace this code in AjaxLink.php:
switch($requestHandler) { case 'GET': $js[] = sprintf("%s.get('%s', %s, function(data, textStatus) { %s }, '%s');return false;", $jqHandler, $url, $params, implode(" ", $callbackCompleteJs), $options['dataType']); break; case 'POST': $js[] = sprintf("%s.post('%s', %s, function(data, textStatus) { %s }, '%s');return false;", $jqHandler, $url, $params, implode(" ", $callbackCompleteJs), $options['dataType']); break; }
on this (it solves the problem):
switch($requestHandler) { case 'GET': $js[] = sprintf("%s.get(\"%s\", %s, function(data, textStatus) { %s }, \"%s\");return false;", $jqHandler, $url, $params, implode(" ", $callbackCompleteJs), $options['dataType']); break; case 'POST': $js[] = sprintf("%s.post(\"%s\", %s, function(data, textStatus) { %s }, \"%s\");return false;", $jqHandler, $url, $params, implode(" ", $callbackCompleteJs), $options['dataType']); break; }
I have the same problem like in this article "http://zend-framework-community.634137.n4.nabble.com/jQuery-Ajax-link-inside-container-how-to-make-this-td663656.html"
my ajax link does not work inside container (called by another ajaxlink). Could someone help me?