Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Problems in Ajax Posting Ajax with jQuery.Validate #328

Closed
gizmohd opened this Issue · 22 comments

5 participants

@gizmohd

When trying to get signalR to work on for the first time I spent hours trying to get it to work.. Once I stepped through everything, I found that the problem lied in the signalR jquery....

My fix was to change all of the $.ajax calls from:
$.ajax(url,{
global: false,
type: "POST",
dataType: "json",.....
To this:
$.ajax({
global: false,
type: "POST",
url: url,
dataType: "json",.......

very innocuous fix... but it solved ALL of my problems with using the product...

@davidfowl
Owner

Seems it's worth fixing.

@cburgdorf

@gizmohd that's kinda strange. I would understand it if you were using a jquery version prior to 1.5 because the changed the signature towards the one with the leading url then: https://github.com/jquery/jquery/blob/1.5/src/ajax.js#L327

However, you would see bigger issues then because back in those old days there were no deferred objects that signalR happens to use a lot.

@davidfowl
Owner

Seems this works fine. Do you have any other modules that might be causing this issue? Maybe jquery validate?

@gizmohd
@davidfowl
Owner
@gizmohd
@davidfowl
Owner
@gizmohd
@redsquare

@gizmohd How can you expect to issue a fix without being confident of the root cause. You should at least be able to isolate and reproduce the problem. What happens if your fix starts to impact other users?
Can you paste the source html and show us exactly which scripts are being rendered to the client? IIRC Telerik auto includes jQuery unless you turn it off so its possible that you have two copies (and different versions?) of jquery going down the wire to the client which is causing you difficulty.

@gizmohd
@cburgdorf

Btw, I know this doesn't help here and I'm probably getting punched for raising it now BUT wouldn't it be better to rewrite the whole js code so that it doesn't depend on jQuery?

@redsquare

+1 for this

@cburgdorf

On a side note. There is nothing wrong with the patch @gizmohd suggested. It's the ajax signature that was there long before the one signalR uses today (see my first comment on this). Still I also feel the need to first track down the root cause of this bug.

@redsquare

I know but jQuery accepts both signatures so it suggests something else is up rather than needing any patch here.

@gizmohd
@davidfowl
Owner
@cburgdorf

@davidfowl Well, the benefit isn't that small actually. Think of all the potentially signalR users that don't use jquery. Should they really take a dependency on such a big library? For what is signalR using jquery anyway? Isn't it just for deferreds and the ajax API?

@davidfowl
Owner

@cburgdorf Lets not discuss this topic in this forum, it takes away from the actual bug at hand. If you want to discuss SignalR's js client's dependency on jQuery create a new issue or discuss it in the SignalR room on jabbr.

@DamianEdwards
@davidfowl
Owner

@gizmohd Back to the issue, here's my isolated application with jQuery 1.7.2:

<script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.signalR.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        var connection = $.connection('echo');

        connection.start();
    });
</script>

Works fine. I'm just going to assume this is the jQuery validate problem here #145. If moving the url to the options object fixes then I'll be happy to take this patch in. Don't take our tone as being proud of the code.

When you file bugs it's important we have all the information so we can make the correct decisions.

@gizmohd
@davidfowl
Owner

I just confirmed that this *isI the jQuery.Validation issue described in #145. It's fixed in 1.8.1 it seems.

@davidfowl davidfowl closed this in 267a80c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.