469,276 Members | 1,630 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,276 developers. It's quick & easy.

jQuery: Function gives... Nothing?

Thew
69
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <title>Example</title>
  5.         <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
  6.         <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
  7.         <script type="text/javascript">
  8.             (function($){
  9.                 $.fn.awnlapi = function(apikey, type, image, xhtml = false, alt) {
  10.                     if(xhtml == false){
  11.                         var endtag = '>';
  12.                     }
  13.                     else
  14.                     {
  15.                         var endtag = '/>';
  16.                     }
  17.  
  18.                     $(fn).html('<img src="http://api.mywebsite.com/api.php?apikey='+ apikey +'&type='+ type +'&image='+ image +'" alt="'+ alt +'"'+ endtag);
  19.                 }
  20.             }).jQuery;
  21.  
  22.             $().ready(function() {  
  23.                 $('#image').awnlapi('893c5f6119f901f94b3ce67816f77f88127aff353b1a48d2f0f5c9c70a0f571589b84d04', 'gif', '1', false, 'This is alt!'); 
  24.             }
  25.     </head>
  26.     <body>
  27.         <div id="image"></div>
  28.     </body>
  29. </html>
So i have my API, that uses $_GET variables to load an image. The only problem is that it returns nothing. No errors, no warnings, no images...

What is wrong?

Greetings
Mar 5 '11 #1
4 1842
Dormilich
8,651 Expert Mod 8TB
What is wrong?
your function declaration. JS does not support default values. see also the Error Console.
Mar 5 '11 #2
Thew
69
Removed the
Expand|Select|Wrap|Line Numbers
  1.  = false
... But error console was empty.
Mar 5 '11 #3
Dormilich
8,651 Expert Mod 8TB
that is what a fix is supposed to do.
Mar 5 '11 #4
Thew
69
But it still doesn't show anything. So...
Mar 6 '11 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by knoak | last post: by
1 post views Thread by tencip | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.