0

In my start.php I was calling few function on button click event.

This function was calling some other functions from .js file included in it.

Now I created new file login.php. On this when user perform successful login I load start.php through ajax call.

But now when I click button it says :

Uncaught TypeError: Object [object Object] has no method 'rateit'

Though I have included .js files and functions in login.php.

Here is the link to both of them:

login.php - https://gist.github.com/karimkhanp/74b81267c4ae870dd432

start.php - https://gist.github.com/karimkhanp/94a601d5bf9f5bb2dee0

1 Answer 1

1

When the login page loads it can't bind the functions you are creating for the start page to the elements that don't yet exist. For instance the element #rateit99 can't be used in the script in login.php because it doesn't exist when that page loads.

You need to move the script part that relates to the start.php back into that php file. This way when it loads start.php through ajax it will bind the functions correctly.

Sign up to request clarification or add additional context in comments.

2 Comments

exactly. @ #rateit99 I am getting error. But if I place rate=$('#rateit99').rateit('value'); in start.php then how can I get value of rate in login.php
You may need to update an element in the login.php with the value of rateit when it changes. I believe that the start.php would have access to the elements in login.php, but not the other way around. Then instead of setting the value from rate=$('#rateit99').rateit('value'); you would set it from a hidden element in the login.php.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.