Having issues with Echo PHP/JS [closed] - javascript

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I hava an issue with my PHP/javascript code
I dont understand how to escape code it breaks my brain
echo "<button id='$date' onclick = 'document.getElementById('$date').style.display ='none'';>$date</button>";
anyone have an idea?
Everything after getElementById(' is not interpreted anymore

You have to correct the quotes.
echo "<button id=`$date` onclick = `document.getElementById('$date').style.display ='none'`;>$date</button>";
If button id is from php, you have to correct this too.

This should work
echo "<button id='$date' onclick = \"document.getElementById('$date').style.display ='none'\";>$date</button>";

Related

String equality( == ) issue in javascript [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I am getting undesired output when i compare the ajax response to a string.
My backend is PHP. It is an echo 'SUCCESS' that responds to the ajax call.
When i compare the response with "SUCCESS" it is giving a false output!
Let me attach a screenshot of the console watch window for clarity.
Please help me with a workaround. Thank you!
I guess there is a space in the success written at the top (pinkish) one. Remove that. For checking give a space in the if condition. If it succeeds then that is the issue.

Using \ for template of html in javascript [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
Why is it I got error of unexpected illegal of TOKEN using below code?
var html = '<div id="wrap">\
<img style="width:100%;display:block">\
<div>\'
console.log(html);
I use \ to escape, it should work fine..
Here is the problem:
<div>\'
You are escaping the closing quote.
Try this
var html = '<div id="thermal-close-sales-wrap">\
<img style="width:100%;display:block">\
<div>'
console.log(html);

validator.js bootstrap works but show not a function error [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I have ajax form as on modal window. I want to validate the fields and i have followed the following tutorial. and Add the validator.js script into my project.
event.preventDefault();
//$('#myOrderDetailsForm').validator();
$('#myOrderDetailsForm').validator('validate')();
Here is what am seeing :
So wired .
Instead of this:
$('#myOrderDetailsForm').validator('validate')();
Use following:
$('#myOrderDetailsForm').validator('validate'); //removed ()

Retuning a string in PHP [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I wanted to return following string, but I still couldn't get it done right for couple of hours. CAn anyone tell me what did I do wrong? Thank you.
<?php
return 'rs...#gmail.com.com';
?>
You have single quotes in the JavaScript code in your onclick attribute. You need to escape these by placing a backslash before each single quote.

Is there anything wrong in this Javascript line? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
my code is not working after adding style property, here it is:
$("#instaUser").append("<figure style='"display:inline "'><img id='"+i+"' src='"+data.data[i].profile_picture+"' alt='pic number "+i+"' height='"+200+"' width='"+200+"'> <figcaption>#"+data.data[i].username+"</figcaption></figure>");
could it be that i used the " in a wrong way?
You don't need double quotes wrapping display: inline
This is correct:
$("#instaUser").append("<figure style='display:inline'><img id='"+i+"' src='"+data.data[i].profile_picture+"' alt='pic number "+i+"' height='"+200+"' width='"+200+"'> <figcaption>#"+data.data[i].username+"</figcaption></figure>");

Categories

Resources