POST is not getting through to web service - ajax

I've added my code to pastebin at the following address:
http://pastebin.com/L03zGPhS
The service is up and running.
I can invoke it. I am additionally using firebug and getting the following results on the POST:
POST http://localhost:51204/AddrService.asmx/GetZipCode
15ms
HeadersPostResponse
JSON
zip
"40"
Source
{'zip': '40' }
Showing the service function:
[WebMethod]
public List<Zip> GetZipCode(string zip)
I can get this to work with jQuery 1.4.2, but I'm upgrading a lot of jQuery widgets to 1.8 and can't get the autocomplete to work. Am I missing something they changed in the AJAX autocomplete call. Documentation to a correct answer will suffice if it is useful.
UPDATE I found through Google Chrome that I'm getting a 500 error. I'm not certain why because I'm hitting localhost on both the service and the aspx page. Does anybody know if they changed something that would affect the security of hitting localhost, or if I could have possibly left out and important jQuery reference that would let autocomplete work for 1.4 but not 1.8?

Maybe this sheds light on your problem — the autocomplete API states that :
"You must always call the response callback even if you encounter an
error. This ensures that the widget always has the correct state."
(source : http://api.jqueryui.com/autocomplete/#option-source)

Related

XML Sitemap not working with Google Search Console..?

I have an XML sitemap located at https://store.usbswiper.com/sitemap_index.xml, which as you can see loads just fine.
However, Google Search Console is telling me it can't fetch the sitemap.
When I use this validator it's giving me a successful validation.
I have checked the robots.txt, and it's not blocking anything. It specifices the sitemap URL correctly as well.
Any info on why Google Search Console is giving me this "couldn't fetch" message would be greatly appreciated.
EDIT: When I first ran that validator it gave me this error:
Incorrect http header content-type: "" (expected: "application/xml")
I added a robots.txt and then when I ran it and posted this thread it was validating successfully. I just now tried again and it's failing again with the same message. I don't understand why it's working sometimes and sometimes not. The Search Console hasn't successfully loaded at all no matter what the validator is doing.
Add the full link in console;
for example, add https://example.net/sitemap.xml
rather than just sitemap.xml.

Handling empty HTTP response with Glimpse

I'm integrating Glimpse to a legacy production application (Upgraded to MVC3). Most pages have a lot of ajax requests and some of the ajax requests return an empty response based on the business logic.
Glimpse client fails to parse such empty responses (out of may be 20-30 responses). Chrome console clearly shows where it fails.
Uncaught TypeError: Cannot call method 'indexOf' of null Glimpse.axd?n=glimpse_client&hash=0a37c827:3633
display.ajax.processContentType Glimpse.axd?n=glimpse_client&hash=0a37c827:3633
display.ajax.update Glimpse.axd?n=glimpse_client&hash=0a37c827:3657
display.ajax.XMLHttpRequest.open
The reason is that the processContentType function is given a 'null' as contentType (variable named 'type' within the function) and the following statement fails.
return type.substring(0, type.indexOf(';'));
What bothers me is the fact that the whole Glimpse window does not show up (Glimpse icon is not hyper-linked to open up the Glimpse tabs) as a result. Is there anyway (configuration?) to workaround the issue?
Thank you!
The issue was resolved by updating Glimpse to 1.5.0.
---Here's the comment from Glimpse;
avanderhoorn commented 6 hours ago
You must be running an old version of Glimpse.core. This was fixed with PR #401 (reported in
#400) and went live in release https://github.com/Glimpse/Glimpse/releases/1.5.0.
All I did was 'Update-Package Glimpse' in VS package manager console and it's fixed now.

How to debug a failed ajax request in google chrome?

I have a web application that crashes on ajax requests with google chrome (it works with every other web browser it was tested it). After debugging I found that the error is caused by response.responseText being undefined. The xhr object looks like this:
argument: undefined
isAbort: false
isTimeout: undefined
status: 0
statusText: "communication failure"
tId: 3
In debugger in the 'network' tab I get "(failed)", however all the headers are there and I can even copy into clipboard the response body (which is a valid JSON).
My question is - how can I debug this problem? Where to find additional information, what causes this request to fail?
I finally found the solution to my problem : AdBlocks, when it blocks an ajax request, it just says "communication failure".
The first thing I would double-check is that the data coming back from the response is valid JSON. Just pass it through a JSON validator like this online JSONLint: http://jsonlint.com/
I assume that you are using something like jQuery to make your AJAX requests. If so, then make sure that you are using the development version of that library. Now that you are using the development version (uncompressed) of the script, find the particular function that you are using (eg. $.ajax) and then, within the Chrome inspector, insert a breakpoint in the code where the AJAX response is first handled (eg. https://github.com/jquery/jquery/blob/master/src/ajax.js#L579). Then proceed to step through the code, inspecting various return-values to see exactly what is going wrong.
If you are not using something like jQuery to make AJAX calls, then I'd recommend using a framework to avoid possible cross-browser compatibility issues like you might be experiencing right now.

Wicket.Ajax.Call.failure: Error while parsing response: Object required

I just spent several hours of my life debugging this problem. I'm documenting it here for others.
Question:
I'm getting the following error when I try to click on an AjaxLink in Internet Explorer:
Wicket: ERROR: Wicket.Ajax.Call.failure: Error while parsing response: Object required
It works fine in all other browsers; just IE is busted.
Check to make sure that your HTML is 100% syntactically correct. Ajax responses are returned to the browser inside a CDATA section, and if the payload is not well-formed, IE will sometimes choke.
In my case I neglected to close a <link> tag in the <head> section. Simply closing that link tag made all the difference.
Aside: if you ever come across a tough-to-solve problem in Wicket, it's a good idea to create a quickstart project that reproduces your issue. It can be a lot of work to boil things down, but in doing so you often find the source of the problem.
I want to note one more potential reason for the issue with Wicket's AJAX in IE. It might help someone, who encounters similar problem.
In my case I had the following error message in IE:
Wicket: ERROR: Wicket.Ajax.Call.failure: Error while parsing response: could not find root <ajax-response> element
The reason was an incorrect Content-Type of AJAX response. I used AbstractTransformerBehavior and there was a bug in Wicket 1.4.x so this behavior was rewriting response Content-Type with text/html. IE does not parse such response as XML.

Ajax call from local html page in Webkit Qt

I'm trying to perform an Ajax/XMLHTTPrequest from within a local HTML file in QT 4.7RC QWebview. It consistently fails with an empty responseText and status 0. I've set the follwing
page->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls,true);
but it has no effect (I can load remote images without problems though).
It seems to be a known issue and I'm not sure if there is a solution already.
https://bugs.webkit.org/show_bug.cgi?id=31875
Any ideas for a workaround would be very helpful. Basically what I'm trying to do is running a HTML/Javascript WebApp in QWebview that talks to a local server at 127.0.0.0 and this problem is kind of a show-stopper. Interestingly, the actual query is sent and my server responds with 200 and the requested data. But the response never arrives in my Javascript callbacks.
Not sure about your question but are you sure that you are inside an AJAX security sandbox that works with webkit? In Firefox, IE and others using AJAXin different domains does not work. In fact, http://demo1.demo.com is different than demo2.demo.com

Resources