Okay, I’m calling a PHP using Ajax for a file upload.
else if (in_array($file_extn, $allowed)=== false){
echo '<script type = "text/javascript">window.alert("The only file types allowed are .jpg, .gif, .png");</script>';
echo '<script type = "text/javascript">$(document).ready(function(){$.parent("#loadimg").fadeOut();});</script>';
}
The alert works no problem but the second echo isn’t working. It is not fadingOut the ID.
What is the problem?
You need a selector to tell jQuery what to get the
parent()of.See: http://api.jquery.com/parent/
Note the first line of the first paragraph, “Given a jQuery object that represents a set of DOM elements…”
If you’re trying to fade out
#loadimg, then try this:And if you’re trying to fade the parent of
#loadimg: