Mo Saeedi
Mo Saeedi

Reputation: 575

value is not passed by javascript function to php file

i'm newbie to javascript and i have create a function by myself but it's not working

function oi_delete(ns_oi){
alert("Are You Sure About DELETE image # " + ns_oi + " ?");
$.post('insert.php', {ns_oi:ns_oi});
location.reload();}

alert and location is working but seconde line: $.post('insert.php', {ns_oi:ns_oi}); is not working or maybe working wrong!

i have create this function to send a value "ns_oi" to insert.php and in insert.php i have get that value and do something

can anyone help me and say what is the problem?

Upvotes: 0

Views: 52

Answers (1)

Darren
Darren

Reputation: 13128

Why don't you send it properly with a jQuery.post() function properly like:

function oi_delete(ns_oi){
    alert("Are You Sure About DELETE image # " + ns_oi + " ?");

    $.post('insert.php', {ns_oi:ns_oi}, function(data) {
        location.reload();
    });

}

Upvotes: 1

Related Questions