[jQuery] Re: ajax request with datatype:script
the second parameter is success, still need to eval(data) to create those vars On Sep 23, 11:23 am, david [EMAIL PROTECTED] wrote: the success function takes a second parameter, the status of the response evaluation. Can you please check it ? On Sep 23, 2:08 am, seo++ [EMAIL PROTECTED] wrote: I am not getting an array, I am getting ids.js contents On Sep 22, 8:12 pm, FrenchiINLA [EMAIL PROTECTED] wrote: inside of your success function success: function(data){} you should refer to 'data' if you're getting back an array, you can refer to as data[0][0] On Sep 21, 9:04 pm, seo++ [EMAIL PROTECTED] wrote: I am trying to insert array elements through ajax request, these elements are also arrays or multidimensional arrays. here is an example main script : var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: script, success: function(data){ alert( list[1][0] ); } }); ids.js contents: list[1] = [['aaa', 'bbb'], ['ccc', 'ddd']]; that would produce ' list is undefined' error but changing datatype to 'html' and adding eval() would work fine var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: html, success: function(data){ eval( data); alert( list[1][0] ); } }); any ideas what am i doing wrong ?
[jQuery] Re: ajax request with datatype:script
the success function takes a second parameter, the status of the response evaluation. Can you please check it ? On Sep 23, 2:08 am, seo++ [EMAIL PROTECTED] wrote: I am not getting an array, I am getting ids.js contents On Sep 22, 8:12 pm, FrenchiINLA [EMAIL PROTECTED] wrote: inside of your success function success: function(data){} you should refer to 'data' if you're getting back an array, you can refer to as data[0][0] On Sep 21, 9:04 pm, seo++ [EMAIL PROTECTED] wrote: I am trying to insert array elements through ajax request, these elements are also arrays or multidimensional arrays. here is an example main script : var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: script, success: function(data){ alert( list[1][0] ); } }); ids.js contents: list[1] = [['aaa', 'bbb'], ['ccc', 'ddd']]; that would produce ' list is undefined' error but changing datatype to 'html' and adding eval() would work fine var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: html, success: function(data){ eval( data); alert( list[1][0] ); } }); any ideas what am i doing wrong ?
[jQuery] Re: ajax request with datatype:script
Hi, What do you get from the server side ? I think you are getting a json structure. But this is text for javascript till you make eval; instead of the ajax function try getjson. Best regards, David On Sep 22, 7:04 am, seo++ [EMAIL PROTECTED] wrote: I am trying to insert array elements through ajax request, these elements are also arrays or multidimensional arrays. here is an example main script : var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: script, success: function(data){ alert( list[1][0] ); } }); ids.js contents: list[1] = [['aaa', 'bbb'], ['ccc', 'ddd']]; that would produce ' list is undefined' error but changing datatype to 'html' and adding eval() would work fine var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: html, success: function(data){ eval( data); alert( list[1][0] ); } }); any ideas what am i doing wrong ?
[jQuery] Re: ajax request with datatype:script
server side sends ids.js mentioned in first post it's a JavaScript array On Sep 22, 2:33 pm, david [EMAIL PROTECTED] wrote: Hi, What do you get from the server side ? I think you are getting a json structure. But this is text for javascript till you make eval; instead of theajaxfunction try getjson. Best regards, David On Sep 22, 7:04 am, seo++ [EMAIL PROTECTED] wrote: I am trying to insert array elements throughajaxrequest, these elements are also arrays or multidimensional arrays. here is an example main script : var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: script, success: function(data){ alert( list[1][0] ); } }); ids.js contents: list[1] = [['aaa', 'bbb'], ['ccc', 'ddd']]; that would produce ' list is undefined' error but changingdatatypeto 'html' and adding eval() would work fine var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: html, success: function(data){ eval( data); alert( list[1][0] ); } }); any ideas what am i doing wrong ?
[jQuery] Re: ajax request with datatype:script
the server side sends ids.js it's a JavaScript Array On Sep 22, 2:33 pm, david [EMAIL PROTECTED] wrote: Hi, What do you get from the server side ? I think you are getting a json structure. But this is text for javascript till you make eval; instead of the ajax function try getjson. Best regards, David On Sep 22, 7:04 am, seo++ [EMAIL PROTECTED] wrote: I am trying to insert array elements through ajax request, these elements are also arrays or multidimensional arrays. here is an example main script : var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: script, success: function(data){ alert( list[1][0] ); } }); ids.js contents: list[1] = [['aaa', 'bbb'], ['ccc', 'ddd']]; that would produce ' list is undefined' error but changing datatype to 'html' and adding eval() would work fine var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: html, success: function(data){ eval( data); alert( list[1][0] ); } }); any ideas what am i doing wrong ?
[jQuery] Re: ajax request with datatype:script
I am not getting an array, I am getting ids.js contents On Sep 22, 8:12 pm, FrenchiINLA [EMAIL PROTECTED] wrote: inside of your success function success: function(data){} you should refer to 'data' if you're getting back an array, you can refer to as data[0][0] On Sep 21, 9:04 pm, seo++ [EMAIL PROTECTED] wrote: I am trying to insert array elements through ajax request, these elements are also arrays or multidimensional arrays. here is an example main script : var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: script, success: function(data){ alert( list[1][0] ); } }); ids.js contents: list[1] = [['aaa', 'bbb'], ['ccc', 'ddd']]; that would produce ' list is undefined' error but changing datatype to 'html' and adding eval() would work fine var list = []; $.ajax({ type: POST, url: 'http://example.com/ids.js', data: id=1 , dataType: html, success: function(data){ eval( data); alert( list[1][0] ); } }); any ideas what am i doing wrong ?