I'm quite new to javascript and can't find the solution. I have the following code.

```
<form class="edit-task-form">
<legend>Create Task</legend>
<label>Task</label>
<input type="text" name="task" />
<hr />
<button type="submit" class="btn">Create</button>
</form>
```

```
var taskDetails = $(ev.currentTarget).serializeObject();
var task = new Task;
task.save(taskDetails, {
success: function(task) {
alert(task.toJSON());
}
});
console.log(taskDetails);
```

```
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if(o[this.name] !==undefined) {
if(!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
}
else {
o[this.name] = this.value || '';
}
});
return o;
```

The output is: Object {task: "fasdfasd"}

I would like it to be: Object {"task": "fasdfasd"}

How may I proceed to have "task" to appear in quotation marks?

Thanks a lot!

David

Answer:1

You have this function:

```
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if(o[this.name] !==undefined) {
if(!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
}
else {
o[this.name] = this.value || '';
}
});
return o;
```

you need to change it to this:

```
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if(o['"'+this.name+'"'] !==undefined) {
if(!o['"'+this.name+'"'].push) {
o['"'+this.name+'"'] = [o[this.name]];
}
o['"'+this.name+'"'].push(this.value || '');
}
else {
o['"'+this.name+'"'] = this.value || '';
}
});
return o;
```

Just add to the key the quotes

Answer:2

Any help converting Excel "power of" function to JavaScript? Values are: A1 = 99% A2 = 45 formula is = (A1^A2)*100 results rounded to whole number is 64.

Any help converting Excel "power of" function to JavaScript? Values are: A1 = 99% A2 = 45 formula is = (A1^A2)*100 results rounded to whole number is 64.

- excel power of 2
- excel power of 10
- excel power of e
- excel power of 3
- excel power of symbol
- excel power of 2 formula
- excel power of function
- excel power of number
- excel power of two
- excel power of 4
- excel power of n
- excel power of negative number
- excel power of 2 symbol
- excel power of
- excel power of matrix
- excel power of calculation
- excel of power bi
- excel axis power of 10
- excel formula power of x
- excel formula power of n

I'm trying to scroll the page down when I click a button with an animation to a certain distance, currently, I'm able to scroll down to a certain element but this is not what I want, I want to scroll ...

I'm trying to scroll the page down when I click a button with an animation to a certain distance, currently, I'm able to scroll down to a certain element but this is not what I want, I want to scroll ...

- can't scroll down on certain websites

I have a dropdown selection field and other fields. It goes like this, <div class="form-group"><label class="sr-only" for="id_max_size">Max Size</label><select name="max_size"...

I have a dropdown selection field and other fields. It goes like this, <div class="form-group"><label class="sr-only" for="id_max_size">Max Size</label><select name="max_size"...

Does anyone know how to do a pull to refresh in a mobile site? I can see some conflicting issues that could be found from trying to implement this such as Chrome already does this from the browser by ...

Does anyone know how to do a pull to refresh in a mobile site? I can see some conflicting issues that could be found from trying to implement this such as Chrome already does this from the browser by ...

- angularjs pull to refresh