is there any possible way to concatenate these two variables in ajax call
1.'+result[i].docNo+'
2.'+result[i].pId+'
I am trying so many ways like this ---> '+result[i].docNo+' + '+result[i].petitionId+'
but, notthing works for me. can anyone please give me a solution for this problem.
What you need is result[i].docNo + result[i].petitionId.
When you use ' ', whatever inside is treated as String
Related
Let's assume that my template is like a following
string1=${obj.firstString}
string2=${obj.secondString}
number1=${obj.firstNumber}
I'm looking for some automatic way to wrap all my string parameters with single quotas? The expected output is
string1='A'
string2='B'
number1=42
I understand that I can write string1=${"'" + obj.firstString + "'"} , but maybe there is some more conventional way for this requirement...
Thanks a lot!
I would just do this:
string1='${obj.firstString}'
string2='${obj.secondString}'
number1=${obj.firstNumber}
It's a template language, so the basic idea is to make your program look similar to its own output.
I need to use the variable inside the popup tag from Smarty.
I can't declare the var on the server because it's dynamic (originating from a loop).
I tried all the different approaches with the assign tag like
{assign var=title value="$some_loop_var - sitename!"}
or
{assign var="myfield" value=$some_loop_var + "btn_licencee_select"}
Always the printed variable is empty.
Any ideas what I might be doing wrong?
The solution was quite trivial in the end:
If you use a variable inside a Smarty function you need to "escape" it with backticks:
{popup text="`$some_loop_var`_static_part" }
Hope this helps anybody else as well. Took me hours to figure this out...
I am scraping a web URL that looks like this:
www.example.com/pages/popup/popup_report_review.aspx?bikeReviewID=6582049&PageTypeID=9&width=900&height=500
I only want the ID number from it. I tried to run this query first to start the parsing after the "=" and it works perfectly:
normalize-space(substring-after(//a[#id='webpage_url']/#href, '='))
So now I have: 6582049&PageTypeID=9&width=900&height=500
I now want to run another query to just leave me with the ID number so I think this is the one:
substring(//a[#id='webpage_url']/#href,1,7)
This leaves me with only 7 characters. They both work perfectly independently, but I cannot get them to run together. I tried using 'and' but that returns me a number 1.. This is what I did:
normalize-space(substring-after(//a[#id='webpage_url']/#href, '=')) and substring(//a[#id='webpage_url']/#href,1,7)
Does anyone know how I can combine both queries or is there a better way to get this ID? Thanks in advance doe any pointers.
I should use this query:
substring-before(substring-after(//a[#id='webpage_url']/#href, '='), '&')
I am testing a registration form and one of the questions before submitting is:
"What is 8 + 4?"
The values will be different every time. I am using Selenium 2 with Ruby and want to to see if anyone knows how to a) get the text from the question and then b) compute the addition and return the correct answer in the field.
Thanks!
Using ruby code try to get the values in between is and ? Store this in Variable and now split the text with deliminator + now you will get the Values in array in different location. Now you can add these two and use for your evaluation. I don't have idea about ruby but its possible in PHP as I have done the same. Its should be in Ruby too.
Getting text between is and ? can be done strpos() in php that gives the position of the string see similar function for ruby.
I have a common issue when working with code in the IDE:
string.Concat("foo", "bar");
and I need to change it to:
string.Concat("bar", "foo");
Often I have several of these that need to be swapped at once. I would like to avoid all the typing. Is there a way to automate this? Either a shortcut or some sort of macro would be great if I knew where to start.
Edit: changed to string.Concat to show that you can't always modify the method signature. I am only looking to change the order of the params in the method call, and nothing else.
<Ctrl> + <Shift> + <t> will transpose two words, so it would work in your case. Unfortunately I don't see this working (without multiple presses) for functions with larger parameter lists...
I had a lot of code with this function:
SetInt(comboBox1.Value + 1, "paramName", ...
SetInt(comboBoxOther.Value, "paramName", ...
And I needed to swap only the first two parameters;
I ended up using some text editor with regular expression management (like Scite), and using this one saved me hours:
Find: SetInt(\([.a-z0-9]+[ + 1]*\), \("[a-z0-9]+"\)
Replace: SetInt(\2, \1