Fhumulani Mabaso
Fhumulani Mabaso

Reputation: 27

how to remove double inverted commas when calling php row value on javascript

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}

Upvotes: 0

Views: 56

Answers (1)

Death-is-the-real-truth
Death-is-the-real-truth

Reputation: 72269

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

Upvotes: 2

Related Questions