-2

I try to print the image using ajax function but in this line it will not work the ajax function if i removed this ajax will work properly how can i fix this???

tbl_row += "<td><img src="<?php echo base_url().'images/'.'"+v.ad_id+"'.'/'.'"+v.ad_id+"'.'_thumb.jpg'; ?>" alt="" /></td>"
5
  • Haven't you forgotten ';' ??? Sep 17, 2013 at 19:51
  • at the end of the line Sep 17, 2013 at 19:54
  • View source in your html output. It will be clearer. Sep 17, 2013 at 19:55
  • @ChrisFarmer the browser will do its best to patch up the dom errors so he may not see all the problems this way
    – andrew
    Sep 17, 2013 at 20:01
  • @andrew It's not even about the DOM. It's about not even knowing what html is being sent to the browser. Sep 17, 2013 at 20:52

1 Answer 1

0

It looks like you're not escaping your double-quotes. You can escape them using the backslash (\)

tbl_row += "<td><img src=\"<?php echo base_url() . 'images/' . '" + v.ad_id + "' . '/' . '"+v.ad_id+"' . '_thumb.jpg'; ?>\" alt=\"\" /></td>";
2
  • <img alt="" src="<?= base_url() . 'images/' . 'AD0016' . '/' . 'AD0016' . '_thumb.jpg' ?>"> answer come like this Sep 17, 2013 at 20:10
  • @user2788487 - I had assumed that you had PHP's shorttags enabled. Try my update. Sep 17, 2013 at 20:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.