1

I am have one doubt , here is what i am trying out

var widgetlink=(window.parent.location.orgin).toString(); //https://www.ajaxcall.com
$.ajax({
            url : widgetlink.concat("/ccm/service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/workItemEditableProperties?includeArchived=false&newWorkItem=true&typeId=task&ignoreScriptBasedAttributeAdvisors=true&projectAreaItemId=")
                    + projectAreaContextId
                    + '&projectAreaConfigurationStateId='
                    + paConfigStateIdList,


            headers : {
                'Accept' : 'text/json',
                'Content-Type' : 'application/x-www-form-urlencoded; charset=utf-8'
            },

Here my exceptation is that the full url shall come i.e https://www.ajaxcall.com/ccm/service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/workItemEditableProperties?includeArchived=false&newWorkItem=true&typeId=task&ignoreScriptBasedAttributeAdvisors=true&projectAreaItemId=_abcdfgr23 ......(rest things) But the problem is i am not able to use concat method due to which WidgetLink string is not able to concat with rest part.So can anyone help me out here to find out where exactly i am doing wrong

  • 1
    Why are you trying to use `concat` instead of simple string concatenation via the `+` operator in that place to begin with? – CBroe Apr 28 '20 at 12:20
  • 3
    concat isn't a string function – evolutionxbox Apr 28 '20 at 12:21
  • @CBore u mean something like url : widgetlink + "/ccm/service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/workItemEditableProperties?includeArchived=false&newWorkItem=true&typeId=task&ignoreScriptBasedAttributeAdvisors=true&projectAreaItemId=") + projectAreaContextId + '&projectAreaConfigurationStateId=' + paConfigStateIdList, – Rajat Krishnan Apr 28 '20 at 12:21
  • @evolutionxbox it is https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat – Ace Apr 28 '20 at 12:22
  • 1
    Write `widgetlink` in lower case when adding suffix material. do not use `concat`, just add the stuff using the `+` operator (which you already do in the argument to `concat` !?) – collapsar Apr 28 '20 at 12:22
  • @evolutionbox According to [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat), it is. But it's nonsense to use it here (and probably anywhere else) – collapsar Apr 28 '20 at 12:23
  • @collapser can you show me how exactly u are telling to write the url? – Rajat Krishnan Apr 28 '20 at 12:24
  • better to encode your URL too. refer https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI – ThilankaD Apr 28 '20 at 12:24
  • @collapsar I am honestly surprised. – evolutionxbox Apr 28 '20 at 12:24
  • @RajatKrishnan I can, but are you really sure that I would do you a favor in doing so ? – collapsar Apr 28 '20 at 12:26
  • @evolutionbox Happens to me all the time ... ;) – collapsar Apr 28 '20 at 12:26
  • Still are you getting the same issue after fix it as said by @collapsar – ThilankaD Apr 28 '20 at 12:26
  • @collapsar i did the same but still i debugger it shows undefined when i have hover over url – Rajat Krishnan Apr 28 '20 at 12:30
  • Use the developer tools the browser furnishes (eg. in Chrome press ctrl-shift-j). Set a breakpoint on your ajax call. Use the browser console to read out values or expressions. replace `widgetlink.concat(...[1]...) + ...[2]...` by `widgetlink + ...[1]... + ...[2]...`. – collapsar Apr 28 '20 at 13:40

0 Answers0