if i have [ if statement ] in my php code than with jquery it is not working...........!!
e.g
if i have
---------------------------

<?php
if(myquery){
}else{
do jquery here
}
?>

------------------------------

but jquery in else area is gone disable how can i fix that.........!!

Recommended Answers

All 3 Replies

Not quite sure what you mean... You cannot put jquery code inside php code. If you mean something else, please try explaining with some more detailed code.

i have done it and by the way we can add jquery code inside php code............!! any way thanks for replying...........!!

I'm not sure I understand what you are wanting, but if I am correct you should be able to do something to the effect of this.

<?php
if (myquery()) {

} else {
?>
<script type="text/javascript">
$("#somediv").someJqueryFunction({some: 'json', data: 'parameters'});
</script>
<?php
}
?>

I would prefer to see the jquery in a separate .js file though and pass it using the source parameter for the script tag.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.