user3378617
user3378617

Reputation:

Calling jquery function after certain php script with parameters

Here is my php code where i am calling the jquery function:

php code

?>
     <script>
        $(function(){
            alertMessage('<?php echo $response ?>');
        });
     </script>
 <?php
   ...more php code...

and the function in javascript file seems like this

function alertMessage(variable){        
$(function(e){
        e.preventDefault();             

        myFunction: jNotify($(this).attr('class'),{
                                VerticalPosition : 'center',
                                HorizontalPosition : 'center'} ); 

});
}

Might be wrong way to do but how can I do this with php parameter in function call. Really Stucked..

Possibly like this Call jquery function from php page, but not working.

Upvotes: 1

Views: 200

Answers (1)

Zahid Khan
Zahid Khan

Reputation: 1260

This type of function call must need an element as parameter. this

myFunction: jNotify($(this).attr('class')

line shows that there must be an element on whom this function is performed. so u can use the above function call as the same but cannot do what you are doing now i.e the

jnotify

action. it must take some element to perform this action.

Upvotes: 1

Related Questions