Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I want to alert the user that their action is successful when they click the button, here is my code. Please Help. Thanks in advance.
<script type="text/javascript">
function postck3() {
$.post('insert_home.php', {
INSERT_WELCOME: CKEDITOR.instances.CKWELCOME.getData()
});
}
</script>
Try
$.post('insert_home.php',{INSERT_WELCOME:editor_data3}).done(function(data){
alert("Success data return ed from server is "+ data);
});
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
How can I redirect an ajax request in php/wordpress.
I tried header("Location: " . "http://redirect.url"); but it doesn't work, the response has 301 Moved Permanently status and the request fails.
You cannot redirect from php by an ajax request. Instead of that you need to do it inside your javascript.
For example if this is your ajax then after success of your request redirect from ajax itself
$.ajax({
type : 'post',
url : 'http://localhost/redirect.php',
success : function(data){
window.location = "http://your/url";
}
});
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Below is a code snippet of my PHP file - I am trying to call a PHP function on click of a button. Simple echo is not working - appreciate any help
/* This function saves Add or Make of Model to Database
*/
$('#addmake-btn').live('click',function(){
<?php
echo "Not Working";
?>
});
</script>
first you need to know about how client side and server side language works.
server side languages like PHP will execute in server, you cant execute them in client side unlike javascript or some other client side language.
$('#addmake-btn').live('click',function(){
var printVal = "<?php echo "Not Working"; ?>";
document.write(printVal);
});
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
i got this simple points system, where when a user clicks on the image it adds 20 points to the database through a mysql query. It works, however, I'm trying to make it so that when a user clicks on the image that it not only adds points to a users database but also goes to a website. I added correctly but then it links but doesn't add points. Any help would be appreciated.
Use Ajax for inserting points in your database and after response(in your success method) send it to your desired URL.
$.ajax({
type: "POST",
url: '/test/points.php',
data: formData,
success: function (dataCheck) {
if (dataCheck) {
window.location = 'www.example.com';
}
}
});
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I have a script that insert into the database ( form ) what I want to do is to send another action to another section after the insert . thanks in advance
First of all you should have to one submit form using Ajax after ajax request is success then you can submit another form.
Please mention whole code you want to submit form one by one...
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I need to jQuery variable value in PHP code in same file with out calling ajax? Please help me it is possible or not. Here jQuery and PHP code here given below.
well you can make use of jquery.session plugin to store Session variable and then you can access that variable using php code.
Sample Code
$(function() {
$.session("myVar", "value");
});
In PHP
echo $_SESSION['myVar'];