This question is locked. New answers and comments are not allowed.
I have HTML code that needs to fire a JavaScript but it does not.
And my JavaScript
I cant seem to figure out why it does not call the function and redirect to next page.
<!-- search -->
<
div
data-role
=
"view"
id
=
"searchview"
data-title
=
"Search"
>
<
div
data-role
=
"content"
class
=
"view-content"
>
<
p
>
<
input
required
=
'required'
class
=
'txt_input'
type
=
'text'
placeholder
=
"e.g. Cape Town or 244 Jean Avenue or Jhon Doe"
id
=
'searchTextField'
/>
</
p
>
<
p
>
<
a
id
=
"btnSearch"
data-role
=
"button"
data-rel
=
"actionsheet"
href
=
"#actionsheet"
data-icon
=
"search"
>Search</
a
>
<
label
id
=
"lblMessage"
></
label
>
</
p
>
</
div
>
<
ul
id
=
"actionsheet"
data-role
=
"actionsheet"
data-cancel
=
"Close"
>
<
li
>
<
li
><
a
id
=
"btnContacts"
data-action
=
"initContactView"
data-click
=
"ContactView()"
>Contacts</
a
></
li
>
<
li
>
<
a
id
=
"btnProperty"
data-action
=
"initpropertyView"
data-click
=
"initpropertyView()"
>Property</
a
>
</
li
>
</
ul
>
</
div
>
<!-- Contacts view list -->
<
div
id
=
"contactsview"
data-role
=
"view"
data-init
=
"initContactView"
>
<
header
data-role
=
"header"
>
<
div
data-role
=
"navbar"
>
<
a
data-align
=
"left"
data-role
=
"backbutton"
data-icon
=
"reply"
class
=
"nav-button"
>Back</
a
>
<
h2
style
=
"text-align:center;"
>Contacts</
h2
>
</
div
>
</
header
>
<
ul
data-role
=
"listview"
data-style
=
"inset"
id
=
"lstView_contacts"
data-template
=
"lstView_contact_Template"
></
ul
>
</
div
>
And my JavaScript
function
ContactView()
{
alert(
"nkjn"
)
var
txtSearchbox = $(
"#searchTextField"
).val();
$.ajax({
type:
"GET"
,
data: param =
"searchField="
+txtSearchbox+
"&office="
+localStorage.getItem(
"office"
)+
"&person="
+localStorage.getItem(
"person"
),
contentType:
"application/json; charset=utf-8"
,
dataType:
"json"
,
success: successContact,
failure:
function
(msg) {
console.log(msg);
}
});
}
/*wsdl call succeed*/
function
successContact(data) {
//apply datasource to listview
$(
"#lstView_contacts"
).kendoMobileListView({
dataSource: JSON.parse(data.d),
template: $(
"#lstView_contact_Template"
).html(),
endlessScroll:
true
,
scrollThreshold: 8
});
window.location =
"#contactsview"
;
}
I cant seem to figure out why it does not call the function and redirect to next page.