Side navigation
#4404 closed bug (invalid)
Opened March 23, 2009 08:13AM UTC
Closed May 16, 2009 02:09AM UTC
Last modified March 15, 2012 01:57PM UTC
using $.ajax with dataType = json causes no action in opera
Reported by: | madmike | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | ajax | Version: | 1.3.2 |
Keywords: | ajax json opera | Cc: | |
Blocked by: | Blocking: |
Description
Good day!
i use $.ajax method to make a custom request to the php script. I need to interpret returned data as json, so i add dataType: 'json' to the options object when accessing this method.
For example such function:
var request = $(this.form).serialize();
var method = $(this.form).attr('method') || 'post';
var action = $(this.form).attr('action') || location.href;
$.ajax({type: method, url: action, data: request, dataType: 'json', success: function() {alert('success');}});
Php script on the requested page returns valid json string and all browsers except Opera understand it right and show alert message 'success', opera has no action in this case, but if i remove property dataType, opera works as good as others.
I've found out where is the error.
I use input types in my form from web forms 2.0. draft recommendation. Opera currently supports such ones like 'email', 'date' and so on. So thus i had the problem with jquery serialize method, because in it's regexp currently there aren't any such types. However in other browsers i use special script from here http://code.google.com/p/webforms2/ to implement the functionality, and using serialize method works nice with such data types, maybe the script dynamically changes them to text.
So then i guess it can be an offer to add search for these new input types to the filter, or make it in different way without such strict rules about type, maybe test if just it is not checkbox, radio and file.
Sorry for wrong bug request.
Regards, Mike.