Background: Most of the research on heart attack prediction has been based on the offline decision-making approach. The Internet of Things (IoT), as a new concept in the field of information technology, enables this to happen online. Objective: This study examined an IoT-based model for predicting heart attack. In this model, electrocardiogram (ECG) information at the moment is used, which facilitates decision-making. Methods: A research model was developed to get emergency cardiac data at the moment. The basis of this model is the IoT, which enables the information to be instantly accessible. In addition, cloud computing has also been used to analyze online data. We enrolled 207 healthy and 64 myocardial infarction cases of visitors to Khatam-ol-Anbia Hospital of Shahrood in 2017. Results: Data set included 19 regular features and 1 label feature. Then, neural networks (NNs) were used for model testing. We used IBM SPSS Ò Modeler V.18 for model testing. After selecting 40% of the data as training set and the rest as the testing set, IBM SPSS Modeler returned 89.5%, which means that with the modeling of these data using NN data mining technique with a probability of 89.5%, we will find the right result. Conclusion: Experiments on the real data set showed that using the IoT, along with cloud computing and data mining techniques, predicts a heart attack with acceptable accuracy. This is achieved by receiving vital signs and ECG information instantaneously.