[英]Issue reading QueryString parameter
Hello everyone and thanks in advance for any help you guys can provide. 大家好,在此先感谢您提供的任何帮助。 Currently I'm having a relatively simple issue but I just can't figure out what's going on.
目前,我遇到了一个相对简单的问题,但是我无法弄清楚发生了什么。
Basically I have a function which calls the getJson jQuery API passing this URL 基本上我有一个函数调用传递此URL的getJson jQuery API
var url = '../../xx/xx/GetCollectionAgencyData?clientIdIn=' +
baseModel.clientId + '&documentNumber=' + self.documentNumber;
I can tell the call is being routed correctly beacuse the breakpoint on the Controller gets hit inside the GetCollectionsAgencyData 我可以判断出呼叫已正确路由,因为Controller的断点在GetCollectionsAgencyData中被击中
The problem I'm having is that for whatever reason when I debug the Controller method I can see the value of the clientIdIn param is passed properly but the documentNumber parameter is passed as null... If I debug the JS I can also see that the self.documentNumber correctly contains the value that I want to pass to the server. 我遇到的问题是,无论出于何种原因,当我调试Controller方法时,我都能看到clientIdIn参数的值正确传递,但documentNumber参数作为null传递...如果我调试JS,我还可以看到self.documentNumber正确包含我要传递给服务器的值。
This is the signature of the method on the Controller 这是控制器上方法的签名
public CollectionAgencyDataDto GetCollectionAgencyData(int? clientIdIn,
int? documentNumber){}
Any ideas why the documentNumber is not being passed correctly from the Client to the Server? 有什么想法为什么documentNumber没有从客户端正确地传递到服务器?
$.getJson("../../xx/xx/GetCollectionAgencyData",
{
clientIdIn: baseModel.clientId,
documentNumber: self.documentNumber // ensure your sending this is an int not string!
},
function(response){
// Success logic...
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.