Hi Mariette,
Make sure the request URL is correct. From your code, the martservice path
is relative to your current path.
You can use BIOMART_CONFIG.service.url to get the proper prefix. Also, you
may want to pass the query inside the data portion of the $.ajax options.
E.g.
$.ajax({
url: BIOMART_CONFIG.service.url + 'results',
data: {
query: '<!DOCTYPE Query><Query client="webbrowser"
processor="TSVX" limit="-1"header="0">'
+ '<Datase name="species_db" config="species_config"><Attribute
name="species__contig__main__length" />'
+ '</Dataset></Query>' }
});
-jack
On 11-10-17 4:50 AM, "Mariette" <[email protected]> wrote:
>Hi everyone,
>I'm new in using biomart and I'm trying to understand how to develop a
>basic plugin. To do so, I have a single mart table:
>contig_db with the table:
> species__contig__main
> - contig_id_key
> - name
> - length
>interfacing an already existing plugin works just fine, I can request
>and I have results displayed.
>I made request using the REST api as following:
>
>http://localhost:9000/martservice/results?query=<!DOCTYPE Query><Query
>client="webbrowser" processor="TSVX" limit="-1"header="0"><Datase
>name="species_db" config="species_config"><Attribute
>name="species__contig__main__length" /></Dataset></Query>
>
>what is working,
>
>however inside my plugin, in my .js if I made the same request as
>following:
>
>function initialize() {
>
> xml = '<!DOCTYPE Query><Query client="webbrowser" processor="TSVX"
>limit="-1"header="0"><Datase name="species_db"
>config="species_config"><Attribute name="species__contig__main__length"
>/></Dataset></Query>';
> $.ajax({
> url: 'martservice/results?query='+xml,
> success: function(data) {
> alert(data);
> }
> });
>}
>
>what is just returning nothing!
>I tryed using the "biomart.resource.load('results', function(json) {"
>function as well but I wasn't more more lucky !
>
>I barely understand how request results are displayed in other plugins,
>if I take martform as example, I get stocke here
> _elements.content.slideUp({
> duration: 'fast',
> complete: function() {
> _elements.results.resultsPanel('run',
> title,
> $.extend({
> queries: xml,
> downloadXml: downloadXml,
> martObj: mart,
> dataAggregation: 'none',
> displayType: 'table'
> }, QUERY_RESULTS_OPTIONS));
> }
> });
>I don't get which function is called to process the data.
>
>Thanks for your help,
>Jerome
>
>_______________________________________________
>Users mailing list
>[email protected]
>https://lists.biomart.org/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
https://lists.biomart.org/mailman/listinfo/users