Permalink
Browse files

Dev: Use createUrl properly for both GET and PATH url settings

  • Loading branch information...
1 parent d4c3a75 commit 85dc0d82fec58fe9877e27861b4f1a57e90bd0bc @olleharstedt olleharstedt committed Nov 17, 2017
@@ -236,7 +236,15 @@
type="hidden"
id="add-input-javascript-datas"
data-url="<?php echo App()->createUrl('/admin/questions/sa/getSubquestionRowForAllLanguages/');?>"
- data-quickurl="<?php echo App()->createUrl('/admin/questions/sa/getSubquestionRowQuickAdd/');?>"
+ data-quickurl="<?php echo App()->createUrl(
+ '/admin/questions/',
+ array(
+ 'sa' => 'getSubquestionRowQuickAdd',
+ 'surveyid' => $surveyid,
+ 'gid' => $gid,
+ 'qid' => $qid
+ )
+ );?>"
data-assessmentvisible="<?php echo (isset($assessmentvisible) && $assessmentvisible==true ? "1" : "0"); ?>"
data-errormessage="An error occured while processing the ajax request."
data-surveyid="<?php echo $surveyid;?>"
View
@@ -114,13 +114,6 @@ function addinputQuickEdit($currentTable, language, first, scale_id, codes)
$codes = JSON.stringify(codes);
// We build the datas for the request
- // NB: URL params.
- urlDatas = {
- 'surveyid' : $elDatas.data('surveyid'),
- 'gid': $elDatas.data('gid'),
- 'qid': $elDatas.data('qid')
- };
- // NB: Post data.
datas = {
'codes': $codes,
'scale_id': scale_id,
@@ -134,7 +127,7 @@ function addinputQuickEdit($currentTable, language, first, scale_id, codes)
// We get the HTML of the new row to insert
$.ajax({
type: "POST",
- url: $url + '?' + jQuery.param(urlDatas),
+ url: $url,
data: datas,
success: function(htmlrow) {
var $lang_table = $('#answers_'+language+'_'+scale_id);
@@ -203,11 +203,6 @@ function addinputQuickEdit($currentTable, language, first, scale_id, codes)
// We convert them to json for the request
$codes = JSON.stringify(codes);
//We build the datas for the request
- urlDatas = {
- 'surveyid' : $elDatas.data('surveyid'),
- 'gid': $elDatas.data('gid'),
- 'qid': $elDatas.data('qid')
- };
datas = {
'codes' : $codes,
'scale_id' : scale_id, // In $elDatas.data('scale-id') ?
@@ -220,7 +215,7 @@ function addinputQuickEdit($currentTable, language, first, scale_id, codes)
// We get the HTML of the new row to insert
$.ajax({
type: "POST",
- url: $url + '?' + jQuery.param(urlDatas),
+ url: $url,
data: datas,
success: function(htmlrow) {
var $lang_table = $('#answers_'+language+'_'+scale_id);

1 comment on commit 85dc0d8

Collaborator

Shnoulle commented on 85dc0d8 Nov 17, 2017

💋

Please sign in to comment.