Please give me some suggestions, I was trying to run following code :
< form name="form1" action="some_action" method="post" onsubmit="somefunction(); return false;">
.... some code...
< input type="submit" value="GET">
< /form>
Here, I want to run onsubmit (which is running well and as expected giving some dialog box as output, working fine)
Then I want to run action which is not running (because of return false in onsubmit) but I want to run it as well by any way.
< form action="login/buy_artifact/0/<?=$row['A_ID']?>/<?=$userid?>" onSubmit="return btn(<?=$i?>,<?=$row['A_ID']?>,<?=$userid?>);">
< input type="submit" name="submit" value=" GET ">
< /form>
function btn(id,art_id,user_id)
{
//alert("called"+id);
var id=id;
var name = document.getElementById("name"+id).innerHTML;
var desc = document.getElementById("description"+id).innerHTML;
var credit = document.getElementById("creditsforquestion"+id).innerHTML;
var art_id=art_id;
var user_id=user_id;
// Only send param data for sample. These parameters should be set
// in the callback.
var order_info = { "name":name,
"description":desc,
"credit":credit,
"aid":art_id,
"uid":user_id
};
// calling the API ...
var obj = {
method: 'pay',
order_info: order_info,
purchase_type: 'item'
};
FB.ui(obj, callback);
var callback = function(data) {
if (data['order_id']) {
writeback("Transaction Completed! </br></br>"
+ "Data returned from Facebook: </br>"
+ "<b>Order ID: </b>" + data['order_id'] + "</br>"
+ "<b>Status: </b>" + data['status']);
} else if (data['error_code']) {
writeback("Transaction Failed! </br></br>"
+ "Error message returned from Facebook:</br>"
+ data['error_message']);
return false;
} else {
writeback("Transaction failed!");
}
};
}
You could do this:
and then in your
somefunctiondecide whether to return true or false based on some condition: