我正在开展一个学校项目,我必须将SQL查询作为输入并将其发送到节点js代码来处理查询。但我不能这样做。我提交查询时收到错误。控制台说:
temp = head1;
while(temp->next != NULL)
temp = temp->next;
//now while loop will break once temp point at the last node i.e. b2 in your case
//Now if you want to move all the element of the first list just do like below
temp->next = head;
//if you want to move only the first element a1 you can do it like below
temp->next = head;
// now you have to move the head node like below in the first list
head = head->next;
Server started listening...
url.js:143
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'url', 'string', url);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type object.
但是当我用第1行检查它时,在HTML页面上它表示变量文本是STRING ....
我应该如何纠正它?
节点js代码如下:
function operation(){
var x = document.getElementById("num1");
var text="";
text = x.elements[0].value;
document.getElementById("yoo").innerHTML = typeof text; //line 1
location.href = "http://localhost:3306" + "?number1=" + text;
}
答案 0 :(得分:0)
您需要将URL字符串传递给url.parse
而不是请求对象。使用request.url
。 Node.JS文档https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost