Issue closed
It worked :)
I would buy your a beer right now, if you were here.
Thank you.
Cheers, Vikas
@aaron
This is the only issue preventing me to close down this functionality. Please help.
I also tried adding another string parameter. It is coming as null.
Hence there seems to be an issue receiving the json object.
Renamed everything(controller and scripts) to as below but value for Xid is coming as 0.
public JsonResult GBVATRegister(IdModel IdModel)
{
string compCode = IdModel.Xid.ToString();
string url = "";
{id: 7}
Hi @aaron,
I made that change. The object is still coming as null.
Regards, Vikas
Hi i am following this guidance.
https://aspnetboilerplate.com/Pages/Documents/Javascript-API/AJAX
Problem: null is received in the controller method. It is hitting the right controller method.
Jquery code
action: function (data) {
var record = { id: data.record.integration.id };
abp.ajax({
url: '/App/Integrations/Register',
data: JSON.stringify(record),
}).done(function (data) {
abp.message.confirm(
'You will be redirected',
'Are you sure?',
function (isConfirmed) {
if (isConfirmed) {
window.location = data.url
}
}
)
});
}
Model
public class IdModel
{
int id { get; set; }
}
Controller method
[HttpPost]
public JsonResult Register(IdModel id)
{
string compCode = id.ToString();
string url = "";
if (!string.IsNullOrEmpty(compCode))
{
var t = new HmrcOauth()
{
State = compCode
};
url = t.GetAuthorizationUrl();
}
object json = new { Url = url };
return Json(json);
}
Please advice. I have already spent 2 days trying different techniques.
Thanks in advance.
Regards, vikas
Hi @entripy
I am facing same issue.
Can you please post the solution?
Cheers, Vikas
window.location = response.url; fixes the problem :)