Show More
@@ -109,24 +109,40 b' define([' | |||||
109 |
|
109 | |||
110 | /** |
|
110 | /** | |
111 | * POST /api/kernels |
|
111 | * POST /api/kernels | |
|
112 | * | |||
|
113 | * In general this shouldn't be used -- the kernel should be | |||
|
114 | * started through the session API. If you use this function and | |||
|
115 | * are also using the session API then your session and kernel | |||
|
116 | * WILL be out of sync! | |||
112 | */ |
|
117 | */ | |
113 | Kernel.prototype.start = function (success, error) { |
|
118 | Kernel.prototype.start = function (params, success, error) { | |
|
119 | var url = this.kernel_service_url; | |||
|
120 | var qs = $.param(params || {}); // query string for sage math stuff | |||
|
121 | if (qs !== "") { | |||
|
122 | url = url + "?" + qs; | |||
|
123 | } | |||
|
124 | ||||
114 | var that = this; |
|
125 | var that = this; | |
115 | var on_success = function (data, status, xhr) { |
|
126 | var on_success = function (data, status, xhr) { | |
|
127 | that.id = data.id; | |||
|
128 | that.kernel_url = utils.url_join_encode(that.kernel_service_url, that.id); | |||
116 | that._kernel_started(data); |
|
129 | that._kernel_started(data); | |
117 | if (success) { |
|
130 | if (success) { | |
118 | success(data, status, xhr); |
|
131 | success(data, status, xhr); | |
119 | } |
|
132 | } | |
120 | }; |
|
133 | }; | |
121 |
|
134 | |||
122 |
$.ajax( |
|
135 | $.ajax(url, { | |
123 | processData: false, |
|
136 | processData: false, | |
124 | cache: false, |
|
137 | cache: false, | |
125 | type: "POST", |
|
138 | type: "POST", | |
|
139 | data: JSON.stringify({name: this.name}), | |||
126 | dataType: "json", |
|
140 | dataType: "json", | |
127 | success: this._on_success(on_success), |
|
141 | success: this._on_success(on_success), | |
128 | error: this._on_error(error) |
|
142 | error: this._on_error(error) | |
129 | }); |
|
143 | }); | |
|
144 | ||||
|
145 | return url; | |||
130 | }; |
|
146 | }; | |
131 |
|
147 | |||
132 | /** |
|
148 | /** |
General Comments 0
You need to be logged in to leave comments.
Login now