问题描述:

My javascript code looks like this

var query = window.location.search.replace('?','');

fetchContent(apiUrl + 'service/' + query + '?callback=?', function(data) {

$('.content').append(data).trigger('create');

});

I am using jQueryMobile, nodeJS for services and views. Also, using EJS templates to display data.

The problem is that I am not able to get value for variable query in the above code and hence the next following lines form up a parameter 'apiUrl/service/?callback=?' for fetchContent method which is a wrong URL for my service. The correct parameter for my fetchContent method should be 'apiUrl/service/1234?callback=?'.

Interesting thing is that this code works fine when I open the link in new tab. URL for the above HTML page in my code is some.html?1234. According to this the value in JS code should be 1234 but it is empty.

相关阅读:
Top