0

I'm trying to send two parameters from PHP to Javascript, but I get second undefined parameter.

<?php echo '<button onclick="deleteImage(\'' . $image->photo_id . ',' . $content->content_id . '\')" >Delete</button>'; ?>

Please help, thank you

1
  • Please show us the code where $content->content_id is supposedly initialized, if that's the one that's undefined. Commented Feb 17, 2016 at 13:39

1 Answer 1

3

I think you forget to escape some ' :

<?php echo '<button onclick="deleteImage(\'' . $image->photo_id . '\',\'' . $content->content_id . '\')" >Delete</button>'; ?>
Sign up to request clarification or add additional context in comments.

Comments

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.