开发者

Get some data of clicked elements to use in a Callback function

开发者 https://www.devze.com 2023-03-17 17:04 出处:网络
I\'m using fancybox to show a form which insert data of something in a list. If it have info in the database, it shows a green dot, if it doesn\'t it shows a grey dot. So, the point is, to perform som

I'm using fancybox to show a form which insert data of something in a list. If it have info in the database, it shows a green dot, if it doesn't it shows a grey dot. So, the point is, to perform some live update when the onClosed event is fired.

I've tried with this solution:

$('a.fancy').click(function(){
                            var _this = $(this);
                            $.fancybox({
                                'hideOnContentClick ': false,
                                'type' : 'iframe',
                                'width' : 700,
                                'autoScale' : false,
                                'height' : '100%',
                                onClosed : function() {
                                    var url = _this.attr('href');
                                    alert (url);
                                }
                            });
                            return false;
                        });

But it opens a window 开发者_如何转开发with this information "The requested URL /gestion/tool/undefined was not found on this server." and they have URL's like this...

<a class="fancy" title="Call performed by: 1302 el 02-07-2011 18:59:18" href="call_view.php?id=1309626036.83693"><img class="viewstats" src="assets/grey.png%20"></a>

Which, in fact, is viewed in the alert!

What's wrong?


Without seeing an actual working example I can only speculate, but try putting a full absolute URL as the href to your link and see if that helps, or changes the outcome in any way.

You could also harvesting your href up where you define _this, that would change the scope of that 'url' variable, which (again in theory) could help, not sure how fancybox deals with variables on those callback functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号