Show More
@@ -109,24 +109,40 define([ | |||
|
109 | 109 | |
|
110 | 110 | /** |
|
111 | 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 | 125 | var that = this; |
|
115 | 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 | 129 | that._kernel_started(data); |
|
117 | 130 | if (success) { |
|
118 | 131 | success(data, status, xhr); |
|
119 | 132 | } |
|
120 | 133 | }; |
|
121 | 134 | |
|
122 |
$.ajax( |
|
|
135 | $.ajax(url, { | |
|
123 | 136 | processData: false, |
|
124 | 137 | cache: false, |
|
125 | 138 | type: "POST", |
|
139 | data: JSON.stringify({name: this.name}), | |
|
126 | 140 | dataType: "json", |
|
127 | 141 | success: this._on_success(on_success), |
|
128 | 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