0

Please help, This is what I am using.

$('#upload-image-form<?php echo json_encode($row['id']); ?>).on('submit', function(e) {some javascript code};

This is what I am getting(view page source)

$('#upload-image-form"475").on('submit', function(e) {some javascript code}

And this is what I want(view page source)

$('#upload-image-form475).on('submit', function(e) {some javascript code}
3
  • this is what i am using: $('#upload-image-form<?php echo json_encode($row['id']); ?>).on('submit', function(e) { Commented Aug 20, 2017 at 21:07
  • 1
    Don't json encode the row id. Just do: <?php echo $row['id']; ?> Commented Aug 20, 2017 at 21:07
  • 1
    Why are you using json_encode here? Commented Aug 20, 2017 at 21:08

1 Answer 1

2

No need of json_encode()here.

Just Change :-

$('#upload-image-form<?php echo json_encode($row['id']); ?>)

to

$('#upload-image-form<?php echo $row["id"]; ?>')

Note:- You missed single quote in end in your original code

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

1 Comment

@FhumulaniMabaso glad to help you :):)

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.